Java 类javax.persistence.GeneratedValue 实例源码

项目:Hibernate_Component_Mapping_Using_DAO_Using_Maven    文件:person.java   
@Id
@Column(name="PID",length=15)
@Type(type="int")
@GenericGenerator(name="gen",strategy="increment")
@GeneratedValue(generator="gen")
    public int getPid() {
        return pid;
    }
项目:hibernate-ogm-redis    文件:Dog.java   
@Id @GeneratedValue(strategy = GenerationType.TABLE, generator = "dog")
@TableGenerator(
    name = "dog",
    table = "sequences",
    pkColumnName = "key",
    pkColumnValue = "dog",
    valueColumnName = "seed"
)
public Long getId() { return id; }
项目:sjk    文件:MonChannelApp.java   
@Override
@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "Id", unique = true, nullable = false)
public Integer getId() {
    return this.id;
}
项目:jeesupport    文件:TabB.java   
/** 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;
    }
项目:wangmarket    文件:User.java   
/**
 * 用户id
 * @return
 */
@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "id", unique = true, nullable = false)
public Integer getId() {
    return this.id;
}
项目:spring-data    文件:Profile.java   
@Id
@GeneratedValue(strategy = IDENTITY)

@Column(name = "id", unique = true, nullable = false)
public Integer getId() {
    return this.id;
}
项目:crnk-framework    文件:JpaResourceFieldInformationProvider.java   
@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();
}
项目:crnk-framework    文件:JpaResourceFieldInformationProvider.java   
@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();
}
项目:lemon    文件:CustomerInfo.java   
/** @return null. */
@Id
@GeneratedValue
@Column(name = "ID", unique = true, nullable = false)
public Long getId() {
    return this.id;
}
项目:sjk    文件:App.java   
@Override
@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "Id", unique = true, nullable = false)
public Integer getId() {
    return this.id;
}
项目:lams    文件:AnnotationBinder.java   
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;
    }
项目:spring-data-jdbc-template    文件:EntityUtils.java   
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;
    }
项目:wangmarket    文件:Log.java   
@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "id", unique = true, nullable = false)
public Integer getId() {
    return id;
}
项目:lemon    文件:OrgPosition.java   
/** @return null. */
@Id
@GeneratedValue
@Column(name = "ID", unique = true, nullable = false)
public Long getId() {
    return this.id;
}
项目:jeesupport    文件:TabA.java   
@GenericGenerator( name = "generator" , strategy = "identity" )
@Id
@GeneratedValue( generator = "generator" )

@Column( name = "id" , unique = true , nullable = false )

public Integer getId() {
    return this.id;
}
项目:Equella    文件:LanguageString.java   
@Override
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
public long getId()
{
    return id;
}
项目:lams    文件:AnnotationBinder.java   
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() );
    }
}
项目:lams    文件:JPAOverriddenAnnotationReader.java   
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;
    }
}
项目:sjk    文件:App.java   
@Override
@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "Id", unique = true, nullable = false)
public Integer getId() {
    return this.id;
}
项目:tinyshop8    文件:GoodsBrand8JPA.java   
@Column(name = "brand_id")
@Override
@Id
@GeneratedValue
public Long getId()
{
    return super.getId();
}
项目:uckefu    文件:Fans.java   
@Id
@Column(length = 32)
@GeneratedValue(generator = "system-uuid")
@GenericGenerator(name = "system-uuid", strategy = "uuid")  
public String getId() {
    return id;
}
项目:uckefu    文件:Message.java   
@Id
@Column(length = 32)
@GeneratedValue(generator = "system-uuid")
@GenericGenerator(name = "system-uuid", strategy = "uuid")  
public String getId() {
    return id;
}
项目:uckefu    文件:TopicComment.java   
@Id
@Column(length = 32)
@GeneratedValue(generator = "system-uuid")
@GenericGenerator(name = "system-uuid", strategy = "uuid")  
public String getId() {
    return id;
}
项目:uckefu    文件:User.java   
/**
 * @return the id
 */
@Id
@Column(length = 32)
@GeneratedValue(generator = "system-uuid")
@GenericGenerator(name = "system-uuid", strategy = "uuid")  
public String getId() {
    return id;
}
项目:JavaEE    文件:Bid.java   
/**
 * Returns the bid id
 * @return bid id
 */
@Id
@GeneratedValue
@Column(name="BID_ID")
public Long getBidId() {
    return bidId;
}
项目:DWSurvey    文件:IdLongEntity.java   
@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;
}
项目:tianti    文件:MysqlSequenceIdEntity.java   
@Id
@Column(length = 32, nullable = true)
@GenericGenerator(name = "sys_uuid", strategy = "uuid")
@GeneratedValue(generator = "sys_uuid")
public String getId() {
    return id;
}
项目:hibernateMaster    文件:Power.java   
@Id
@GenericGenerator(name="generator",strategy="assigned")
@GeneratedValue(generator="generator")
@Column(length=32)
public String getName() {
    return name;
}
项目:jeesupport    文件:TabA.java   
@GenericGenerator ( name = "generator" , strategy = "identity" )
@Id
@GeneratedValue ( generator = "generator" )

@Column ( name = "id" , unique = true , nullable = false )

public Integer getId() {
    return this.id;
}
项目:crud-admin-spring-boot-starter    文件:CrudAdminRepository.java   
public boolean isGeneratedId() {
    return getId().isAnnotationPresent(GeneratedValue.class);
}
项目:sjk    文件:MoViewTagApps.java   
@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "Id", unique = true, nullable = false)
public Integer getId() {
    return this.id;
}
项目:incubator-netbeans    文件:Order.java   
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
public Long getId() {
    return id;
}
项目:incubator-netbeans    文件:Employee.java   
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
public Long getId() {
    return id;
}
项目:wangmarket    文件:PostClass.java   
@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "id", unique = true, nullable = false)
public Integer getId() {
    return this.id;
}
项目:Spring-5.0-Cookbook    文件:Employee.java   
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
public Integer getId() {
    return id;
}
项目:sjk    文件:Keyword.java   
@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "Id", unique = true, nullable = false)
public Integer getId() {
    return this.id;
}
项目:sjk    文件:CatalogConvertor.java   
@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "Id", unique = true, nullable = false)
public Integer getId() {
    return this.id;
}
项目:wangmarket    文件:TemplateVar.java   
@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "id", unique = true, nullable = false)
public Integer getId() {
    return id;
}
项目:Spring-5.0-Cookbook    文件:Employee.java   
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
public Integer getId() {
    return id;
}
项目:Spring-5.0-Cookbook    文件:LoginDetails.java   
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
public Integer getId() {
    return id;
}