@Id @Column(name="PID",length=15) @Type(type="int") @GenericGenerator(name="gen",strategy="increment") @GeneratedValue(generator="gen") public int getPid() { return pid; }
@Id @GeneratedValue(strategy = GenerationType.TABLE, generator = "dog") @TableGenerator( name = "dog", table = "sequences", pkColumnName = "key", pkColumnValue = "dog", valueColumnName = "seed" ) public Long getId() { return id; }
@Override @Id @GeneratedValue(strategy = IDENTITY) @Column(name = "Id", unique = true, nullable = false) public Integer getId() { return this.id; }
/** full constructor */ // Property accessors @GenericGenerator( name = "generator" , strategy = "identity" ) @Id @GeneratedValue( generator = "generator" ) @Column( name = "id" , unique = true , nullable = false ) public Integer getId() { return this.id; }
/** * 用户id * @return */ @Id @GeneratedValue(strategy = IDENTITY) @Column(name = "id", unique = true, nullable = false) public Integer getId() { return this.id; }
@Id @GeneratedValue(strategy = IDENTITY) @Column(name = "id", unique = true, nullable = false) public Integer getId() { return this.id; }
@Override public Optional<Boolean> isPostable(BeanAttributeInformation attributeDesc) { Optional<Column> column = attributeDesc.getAnnotation(Column.class); Optional<Version> version = attributeDesc.getAnnotation(Version.class); if (!version.isPresent() && column.isPresent()) { return Optional.of(column.get().insertable()); } Optional<GeneratedValue> generatedValue = attributeDesc.getAnnotation(GeneratedValue.class); if (generatedValue.isPresent()) { return Optional.of(false); } return Optional.empty(); }
@Override public Optional<Boolean> isPatchable(BeanAttributeInformation attributeDesc) { Optional<Column> column = attributeDesc.getAnnotation(Column.class); Optional<Version> version = attributeDesc.getAnnotation(Version.class); if (!version.isPresent() && column.isPresent()) { return Optional.of(column.get().updatable()); } Optional<GeneratedValue> generatedValue = attributeDesc.getAnnotation(GeneratedValue.class); if (generatedValue.isPresent()) { return Optional.of(false); } return Optional.empty(); }
/** @return null. */ @Id @GeneratedValue @Column(name = "ID", unique = true, nullable = false) public Long getId() { return this.id; }
private static boolean hasAnnotationsOnIdClass(XClass idClass) { // if(idClass.getAnnotation(Embeddable.class) != null) // return true; List<XProperty> properties = idClass.getDeclaredProperties( XClass.ACCESS_FIELD ); for ( XProperty property : properties ) { if ( property.isAnnotationPresent( Column.class ) || property.isAnnotationPresent( OneToMany.class ) || property.isAnnotationPresent( ManyToOne.class ) || property.isAnnotationPresent( Id.class ) || property.isAnnotationPresent( GeneratedValue.class ) || property.isAnnotationPresent( OneToOne.class ) || property.isAnnotationPresent( ManyToMany.class ) ) { return true; } } List<XMethod> methods = idClass.getDeclaredMethods(); for ( XMethod method : methods ) { if ( method.isAnnotationPresent( Column.class ) || method.isAnnotationPresent( OneToMany.class ) || method.isAnnotationPresent( ManyToOne.class ) || method.isAnnotationPresent( Id.class ) || method.isAnnotationPresent( GeneratedValue.class ) || method.isAnnotationPresent( OneToOne.class ) || method.isAnnotationPresent( ManyToMany.class ) ) { return true; } } return false; }
private static Map<String, Accessor> columnMap(Class<?> klass, boolean includesGeneratedValue) { List<Accessor> accessors = new ArrayList<>(); accessors.addAll(getPropertyAccessors(klass)); accessors.addAll(getFieldAccessors(klass)); Map<String, Accessor> result = new HashMap<>(); for (Accessor accessor : accessors) { String columnName = columnName(accessor); if (!result.containsKey(columnName) && (includesGeneratedValue || accessor.getAnnotation(GeneratedValue.class) == null)) { result.put(columnName, accessor); } } return result; }
@Id @GeneratedValue(strategy = IDENTITY) @Column(name = "id", unique = true, nullable = false) public Integer getId() { return id; }
@GenericGenerator( name = "generator" , strategy = "identity" ) @Id @GeneratedValue( generator = "generator" ) @Column( name = "id" , unique = true , nullable = false ) public Integer getId() { return this.id; }
@Override @Id @GeneratedValue(strategy = GenerationType.AUTO) public long getId() { return id; }
private static void processId( PropertyHolder propertyHolder, PropertyData inferredData, SimpleValue idValue, HashMap<String, IdGenerator> classGenerators, boolean isIdentifierMapper, Mappings mappings) { if ( isIdentifierMapper ) { throw new AnnotationException( "@IdClass class should not have @Id nor @EmbeddedId properties: " + BinderHelper.getPath( propertyHolder, inferredData ) ); } XClass returnedClass = inferredData.getClassOrElement(); XProperty property = inferredData.getProperty(); //clone classGenerator and override with local values HashMap<String, IdGenerator> localGenerators = ( HashMap<String, IdGenerator> ) classGenerators.clone(); localGenerators.putAll( buildLocalGenerators( property, mappings ) ); //manage composite related metadata //guess if its a component and find id data access (property, field etc) final boolean isComponent = returnedClass.isAnnotationPresent( Embeddable.class ) || property.isAnnotationPresent( EmbeddedId.class ); GeneratedValue generatedValue = property.getAnnotation( GeneratedValue.class ); String generatorType = generatedValue != null ? generatorType( generatedValue.strategy(), mappings ) : "assigned"; String generatorName = generatedValue != null ? generatedValue.generator() : BinderHelper.ANNOTATION_STRING_DEFAULT; if ( isComponent ) { generatorType = "assigned"; } //a component must not have any generator BinderHelper.makeIdGenerator( idValue, generatorType, generatorName, mappings, localGenerators ); if ( LOG.isTraceEnabled() ) { LOG.tracev( "Bind {0} on {1}", ( isComponent ? "@EmbeddedId" : "@Id" ), inferredData.getPropertyName() ); } }
private GeneratedValue buildGeneratedValue(Element element) { Element subElement = element != null ? element.element( "generated-value" ) : null; if ( subElement != null ) { AnnotationDescriptor ad = new AnnotationDescriptor( GeneratedValue.class ); String strategy = subElement.attributeValue( "strategy" ); if ( "TABLE".equalsIgnoreCase( strategy ) ) { ad.setValue( "strategy", GenerationType.TABLE ); } else if ( "SEQUENCE".equalsIgnoreCase( strategy ) ) { ad.setValue( "strategy", GenerationType.SEQUENCE ); } else if ( "IDENTITY".equalsIgnoreCase( strategy ) ) { ad.setValue( "strategy", GenerationType.IDENTITY ); } else if ( "AUTO".equalsIgnoreCase( strategy ) ) { ad.setValue( "strategy", GenerationType.AUTO ); } else if ( StringHelper.isNotEmpty( strategy ) ) { throw new AnnotationException( "Unknown GenerationType: " + strategy + ". " + SCHEMA_VALIDATION ); } copyStringAttribute( ad, subElement, "generator", false ); return AnnotationFactory.create( ad ); } else { return null; } }
@Column(name = "brand_id") @Override @Id @GeneratedValue public Long getId() { return super.getId(); }
@Id @Column(length = 32) @GeneratedValue(generator = "system-uuid") @GenericGenerator(name = "system-uuid", strategy = "uuid") public String getId() { return id; }
/** * @return the id */ @Id @Column(length = 32) @GeneratedValue(generator = "system-uuid") @GenericGenerator(name = "system-uuid", strategy = "uuid") public String getId() { return id; }
/** * Returns the bid id * @return bid id */ @Id @GeneratedValue @Column(name="BID_ID") public Long getBidId() { return bidId; }
@Id @GeneratedValue(strategy = GenerationType.AUTO) //@GeneratedValue(strategy = GenerationType.AUTO, generator = "uuid-string") //@GeneratedValue(generator = "system-uuid") //@GenericGenerator(name = "system-uuid", strategy = "uuid") //@Column(length = 32) public Long getId() { return id; }
@Id @Column(length = 32, nullable = true) @GenericGenerator(name = "sys_uuid", strategy = "uuid") @GeneratedValue(generator = "sys_uuid") public String getId() { return id; }
@Id @GenericGenerator(name="generator",strategy="assigned") @GeneratedValue(generator="generator") @Column(length=32) public String getName() { return name; }
@GenericGenerator ( name = "generator" , strategy = "identity" ) @Id @GeneratedValue ( generator = "generator" ) @Column ( name = "id" , unique = true , nullable = false ) public Integer getId() { return this.id; }
public boolean isGeneratedId() { return getId().isAnnotationPresent(GeneratedValue.class); }
@Id @GeneratedValue(strategy = IDENTITY) @Column(name = "Id", unique = true, nullable = false) public Integer getId() { return this.id; }
@Id @GeneratedValue(strategy = GenerationType.AUTO) public Long getId() { return id; }
@Id @GeneratedValue(strategy = GenerationType.AUTO) public Integer getId() { return id; }