Package javax.persistence

Examples of javax.persistence.AttributeConverter


   * @param attributeConverterClass The AttributeConverter class.
   * @param autoApply Should the AttributeConverter be auto applied to property types as specified
   * by its "entity attribute" parameterized type?
   */
  public void addAttributeConverter(Class<? extends AttributeConverter> attributeConverterClass, boolean autoApply) {
    final AttributeConverter attributeConverter;
    try {
      attributeConverter = attributeConverterClass.newInstance();
    }
    catch (Exception e) {
      throw new AnnotationException(
View Full Code Here


   * Adds the AttributeConverter Class to this Configuration.
   *
   * @param attributeConverterClass The AttributeConverter class.
   */
  public void addAttributeConverter(Class<? extends AttributeConverter> attributeConverterClass) {
    final AttributeConverter attributeConverter;
    try {
      attributeConverter = attributeConverterClass.newInstance();
    }
    catch (Exception e) {
      throw new AnnotationException(
View Full Code Here

                    builder.append("\\N");
                } else if (method.isAnnotationPresent(Convert.class)) {
                    Class<? extends AttributeConverter<?, ?>> converterClass = method.getAnnotation(Convert.class)
                            .converter();

                    AttributeConverter converter = converterClass.newInstance();
                    builder.append(converter.convertToDatabaseColumn(value));
                } else if (method.isAnnotationPresent(JoinColumn.class)) {
                    // We need to get the id of the joined object.
                    for (Method method2 : value.getClass().getMethods()) {
                        if (method2.isAnnotationPresent(Id.class)) {
                            builder.append(method2.invoke(value));
View Full Code Here

        autoApply
    );
  }

  private AttributeConverter instantiateAttributeConverter(Class<? extends AttributeConverter> attributeConverterClass) {
    AttributeConverter attributeConverter;
    try {
      attributeConverter = attributeConverterClass.newInstance();
    }
    catch (Exception e) {
      throw new AnnotationException(
View Full Code Here

   * @param attributeConverterClass The AttributeConverter class.
   * @param autoApply Should the AttributeConverter be auto applied to property types as specified
   * by its "entity attribute" parameterized type?
   */
  public void addAttributeConverter(Class<? extends AttributeConverter> attributeConverterClass, boolean autoApply) {
    final AttributeConverter attributeConverter;
    try {
      attributeConverter = attributeConverterClass.newInstance();
    }
    catch (Exception e) {
      throw new AnnotationException(
View Full Code Here

   * Adds the AttributeConverter Class to this Configuration.
   *
   * @param attributeConverterClass The AttributeConverter class.
   */
  public void addAttributeConverter(Class<? extends AttributeConverter> attributeConverterClass) {
    final AttributeConverter attributeConverter;
    try {
      attributeConverter = attributeConverterClass.newInstance();
    }
    catch (Exception e) {
      throw new AnnotationException(
View Full Code Here

   * @param attributeConverterClass The AttributeConverter class.
   * @param autoApply Should the AttributeConverter be auto applied to property types as specified
   * by its "entity attribute" parameterized type?
   */
  public void addAttributeConverter(Class<? extends AttributeConverter> attributeConverterClass, boolean autoApply) {
    final AttributeConverter attributeConverter;
    try {
      attributeConverter = attributeConverterClass.newInstance();
    }
    catch (Exception e) {
      throw new AnnotationException(
View Full Code Here

   * Adds the AttributeConverter Class to this Configuration.
   *
   * @param attributeConverterClass The AttributeConverter class.
   */
  public void addAttributeConverter(Class<? extends AttributeConverter> attributeConverterClass) {
    final AttributeConverter attributeConverter;
    try {
      attributeConverter = attributeConverterClass.newInstance();
    }
    catch (Exception e) {
      throw new AnnotationException(
View Full Code Here

    if ( AttributeConverterTypeAdapter.class.isInstance( expectedType ) ) {
      final AttributeConverterTypeAdapter adapterType = (AttributeConverterTypeAdapter) expectedType;
      if ( getDataType().getReturnedClass().equals( adapterType.getModelType() ) ) {
        // apply the converter
        final AttributeConverter converter = ( (AttributeConverterTypeAdapter) expectedType ).getAttributeConverter();
        final Object converted = converter.convertToDatabaseColumn( getLiteralValue() );
        if ( isCharacterData( adapterType.sqlType() ) ) {
          setText( "'" + converted.toString() + "'" );
        }
        else {
          setText( converted.toString() );
View Full Code Here

   * @param attributeConverterClass The AttributeConverter class.
   * @param autoApply Should the AttributeConverter be auto applied to property types as specified
   * by its "entity attribute" parameterized type?
   */
  public void addAttributeConverter(Class<? extends AttributeConverter> attributeConverterClass, boolean autoApply) {
    final AttributeConverter attributeConverter;
    try {
      attributeConverter = attributeConverterClass.newInstance();
    }
    catch (Exception e) {
      throw new AnnotationException(
View Full Code Here

TOP

Related Classes of javax.persistence.AttributeConverter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.