Package javax.persistence

Examples of javax.persistence.Basic


          this.addOneToMany(attributes, propertyDescriptor, om);
        } else if (propertyDescriptor.isAnnotationPresent(OneToOne.class)) {
          OneToOne oo = propertyDescriptor.getAnnotation(OneToOne.class);
          this.addOneToOne(attributes, propertyDescriptor, oo);
        } else if (propertyDescriptor.isAnnotationPresent(Basic.class)) {
          Basic b = propertyDescriptor.getAnnotation(Basic.class);
          this.addBasic(attributes, propertyDescriptor, b);
        } else if (propertyDescriptor.isAnnotationPresent(Id.class)) {
          this.addId(attributes, propertyDescriptor);
        } else if (propertyDescriptor.isAnnotationPresent(Column.class)) {
          Column c = propertyDescriptor.getAnnotation(Column.class);
View Full Code Here


          this.addOneToMany(attributes, propertyDescriptor, om);
        } else if (propertyDescriptor.isAnnotationPresent(OneToOne.class)) {
          OneToOne oo = propertyDescriptor.getAnnotation(OneToOne.class);
          this.addOneToOne(attributes, propertyDescriptor, oo);
        } else if (propertyDescriptor.isAnnotationPresent(Basic.class)) {
          Basic b = propertyDescriptor.getAnnotation(Basic.class);
          this.addBasic(attributes, propertyDescriptor, b);
        } else if (propertyDescriptor.isAnnotationPresent(Id.class)) {
          this.addId(attributes, propertyDescriptor);
        } else if (propertyDescriptor.isAnnotationPresent(Column.class)) {
          Column c = propertyDescriptor.getAnnotation(Column.class);
View Full Code Here

        else {
          //provide the basic property mapping
          boolean optional = true;
          boolean lazy = false;
          if ( property.isAnnotationPresent( Basic.class ) ) {
            Basic ann = property.getAnnotation( Basic.class );
            optional = ann.optional();
            lazy = ann.fetch() == FetchType.LAZY;
          }
          //implicit type will check basic types and Serializable classes
          if ( isId || ( !optional && nullability != Nullability.FORCED_NULL ) ) {
            //force columns to not null
            for ( Ejb3Column col : columns ) {
View Full Code Here

        else {
          //provide the basic property mapping
          boolean optional = true;
          boolean lazy = false;
          if ( property.isAnnotationPresent( Basic.class ) ) {
            Basic ann = property.getAnnotation( Basic.class );
            optional = ann.optional();
            lazy = ann.fetch() == FetchType.LAZY;
          }
          //implicit type will check basic types and Serializable classes
          if ( isId || ( !optional && nullability != Nullability.FORCED_NULL ) ) {
            //force columns to not null
            for ( Ejb3Column col : columns ) {
View Full Code Here

*/
public class JavaxPersistenceImpl implements JavaxPersistenceConfigurer {

  public DatabaseFieldConfig createFieldConfig(DatabaseType databaseType, Field field) {
    Column columnAnnotation = field.getAnnotation(Column.class);
    Basic basicAnnotation = field.getAnnotation(Basic.class);
    Id idAnnotation = field.getAnnotation(Id.class);
    GeneratedValue generatedValueAnnotation = field.getAnnotation(GeneratedValue.class);
    OneToOne oneToOneAnnotation = field.getAnnotation(OneToOne.class);
    ManyToOne manyToOneAnnotation = field.getAnnotation(ManyToOne.class);
    JoinColumn joinColumnAnnotation = field.getAnnotation(JoinColumn.class);
    Enumerated enumeratedAnnotation = field.getAnnotation(Enumerated.class);
    Version versionAnnotation = field.getAnnotation(Version.class);

    if (columnAnnotation == null && basicAnnotation == null && idAnnotation == null && oneToOneAnnotation == null
        && manyToOneAnnotation == null && enumeratedAnnotation == null && versionAnnotation == null) {
      return null;
    }

    DatabaseFieldConfig config = new DatabaseFieldConfig();
    String fieldName = field.getName();
    if (databaseType.isEntityNamesMustBeUpCase()) {
      fieldName = fieldName.toUpperCase();
    }
    config.setFieldName(fieldName);

    if (columnAnnotation != null) {
      if (stringNotEmpty(columnAnnotation.name())) {
        config.setColumnName(columnAnnotation.name());
      }
      if (stringNotEmpty(columnAnnotation.columnDefinition())) {
        config.setColumnDefinition(columnAnnotation.columnDefinition());
      }
      config.setWidth(columnAnnotation.length());
      config.setCanBeNull(columnAnnotation.nullable());
      config.setUnique(columnAnnotation.unique());
    }
    if (basicAnnotation != null) {
      config.setCanBeNull(basicAnnotation.optional());
    }
    if (idAnnotation != null) {
      if (generatedValueAnnotation == null) {
        config.setId(true);
      } else {
View Full Code Here

    }
    else
      throw error(_field, L.l("{0} is an invalid @Basic type for {1}.",
            _fieldType, _fieldName));

    Basic basicAnn = _field.getAnnotation(Basic.class);
    if (basicAnn != null) {
      _fetch = basicAnn.fetch();
      _isOptional = basicAnn.optional();
    }
  
    Column columnAnn = _field.getAnnotation(Column.class);
   
    if (columnAnn != null)
View Full Code Here

        else {
          //provide the basic property mapping
          boolean optional = true;
          boolean lazy = false;
          if ( property.isAnnotationPresent( Basic.class ) ) {
            Basic ann = property.getAnnotation( Basic.class );
            optional = ann.optional();
            lazy = ann.fetch() == FetchType.LAZY;
          }
          //implicit type will check basic types and Serializable classes
          if ( isId || ( !optional && nullability != Nullability.FORCED_NULL ) ) {
            //force columns to not null
            for (Ejb3Column col : columns) {
View Full Code Here

        else {
          //provide the basic property mapping
          boolean optional = true;
          boolean lazy = false;
          if ( property.isAnnotationPresent( Basic.class ) ) {
            Basic ann = property.getAnnotation( Basic.class );
            optional = ann.optional();
            lazy = ann.fetch() == FetchType.LAZY;
          }
          //implicit type will check basic types and Serializable classes
          if ( isId || ( !optional && nullability != Nullability.FORCED_NULL ) ) {
            //force columns to not null
            for ( Ejb3Column col : columns ) {
View Full Code Here

TOP

Related Classes of javax.persistence.Basic

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.