Java 类javax.persistence.Id 实例源码

项目:wangmarket    文件:User.java   
/**
 * 用户id
 * @return
 */
@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "id", unique = true, nullable = false)
public Integer getId() {
    return this.id;
}
项目:lams    文件:JPAOverriddenAnnotationReader.java   
private boolean isProcessingId(XMLContext.Default defaults) {
    boolean isExplicit = defaults.getAccess() != null;
    boolean correctAccess =
            ( PropertyType.PROPERTY.equals( propertyType ) && AccessType.PROPERTY.equals( defaults.getAccess() ) )
                    || ( PropertyType.FIELD.equals( propertyType ) && AccessType.FIELD
                    .equals( defaults.getAccess() ) );
    boolean hasId = defaults.canUseJavaAnnotations()
            && ( isPhysicalAnnotationPresent( Id.class ) || isPhysicalAnnotationPresent( EmbeddedId.class ) );
    //if ( properAccessOnMetadataComplete || properOverridingOnMetadataNonComplete ) {
    boolean mirrorAttributeIsId = defaults.canUseJavaAnnotations() &&
            ( mirroredAttribute != null &&
                    ( mirroredAttribute.isAnnotationPresent( Id.class )
                            || mirroredAttribute.isAnnotationPresent( EmbeddedId.class ) ) );
    boolean propertyIsDefault = PropertyType.PROPERTY.equals( propertyType )
            && !mirrorAttributeIsId;
    return correctAccess || ( !isExplicit && hasId ) || ( !isExplicit && propertyIsDefault );
}
项目:FastSQL    文件:EntityRefelectUtils.java   
public static Field getIdField(Object object) {
    List<Field> fieldList = new ArrayList<>();
    Field[] declaredFields = object.getClass().getDeclaredFields();

    for (Field field : declaredFields) {
        if (field.isAnnotationPresent(Id.class)) {
            fieldList.add(field);
        }
    }
    if (fieldList.size() == 0) {
        throw new RuntimeException(object.getClass().getSimpleName() + "实体类必须有一个包含@Id的字段");
    }
    if (fieldList.size() > 1) {
        throw new RuntimeException(object.getClass().getSimpleName() + "实体类必须有一个包含@Id的字段");
    }
    return fieldList.get(0);
}
项目:tinyshop8    文件:User8JPA.java   
@Id
@GeneratedValue
@Override
public Long getId()
{
    return super.getId();
}
项目:uckefu    文件:TopicView.java   
@Id
@Column(length = 32)
@GeneratedValue(generator = "system-uuid")
@GenericGenerator(name = "system-uuid", strategy = "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;
}
项目:lams    文件:JPAOverriddenAnnotationReader.java   
/**
 * Adds an @Id annotation to the specified annotationList if the specified element has the id
 * attribute set to true. This should only be the case for many-to-one or one-to-one
 * associations.
 */
private void getAssociationId(List<Annotation> annotationList, Element element) {
    String attrVal = element.attributeValue( "id" );
    if ( "true".equals( attrVal ) ) {
        AnnotationDescriptor ad = new AnnotationDescriptor( Id.class );
        annotationList.add( AnnotationFactory.create( ad ) );
    }
}
项目:tinyshop8    文件:GoodsBrand8JPA.java   
@Column(name = "brand_id")
@Override
@Id
@GeneratedValue
public Long getId()
{
    return super.getId();
}
项目:wangmarket    文件:Log.java   
@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "id", unique = true, nullable = false)
public Integer getId() {
    return id;
}
项目:Hotel-Properties-Management-System    文件:Payment.java   
public Payment(long Id, String title, String paymentType, String price, String currency, String explanation,
        String theRoomNumber, String dateTime) {
    super();
    this.id = Id;
    this.title = title;
    this.paymentType = paymentType;
    this.price = price;
    this.currency = currency;
    this.explanation = explanation;
    this.roomNumber = theRoomNumber;
    this.dateTime = dateTime;
}
项目:hibernateMaster    文件:DomainUtil.java   
private static DomainIdAnnotationNotFoundException createIDNotfoundException(Class<? extends Object> clazz) {
    logger.error("在"+clazz.getName()+"中找不到含有"+Id.class.getName()+"注解的get方法,或字段。");
    DomainIdAnnotationNotFoundException exception = new DomainIdAnnotationNotFoundException("在"+
            clazz.getName()+"中找不到含有"+Id.class.getName()+"注解的get方法,或字段。");
    exception.printStackTrace();
    return exception;
}
项目:Hotel-Properties-Management-System    文件:User.java   
public User(long id, String firstName, String lastName, String nickName, String password, String email,
        String role) {
    super();
    Id = id;
    FirstName = firstName;
    LastName = lastName;
    NickName = nickName;
    Password = password;
    Email = email;
    Role = role;
}
项目:GitHub    文件:Order.java   
@Id @GeneratedValue(strategy=IDENTITY)

@Column(name="orderNumber", unique=true, nullable=false)
public Integer getOrderNumber() {
    return this.orderNumber;
}
项目:sjk    文件:Metro.java   
@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "Id", unique = true, nullable = false)
public Integer getId() {
    return this.id;
}
项目:lemon    文件:PermType.java   
/** @return 主键. */
@Id
@Column(name = "ID", unique = true, nullable = false)
public Long getId() {
    return this.id;
}
项目:lemon    文件:AccountOnline.java   
/** @return null. */
@Id
@Column(name = "ID", unique = true, nullable = false)
public Long getId() {
    return this.id;
}
项目:lemon    文件:TicketCatalog.java   
/** @return null. */
@Id
@Column(name = "ID", unique = true, nullable = false)
public Long getId() {
    return this.id;
}
项目:lemon    文件:SendmailAttachment.java   
/** @return null. */
@Id
@Column(name = "ID", unique = true, nullable = false)
public Long getId() {
    return this.id;
}
项目:incubator-netbeans    文件:Employee.java   
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
public Long getId() {
    return id;
}
项目:lemon    文件:BpmConfForm.java   
/** @return 主键. */
@Id
@Column(name = "ID", unique = true, nullable = false)
public Long getId() {
    return this.id;
}
项目:Hibernate_HQL_UniqueResult_ExecuteUpdate_CopyData_Delete_Update    文件:newMall.java   
@Id 
@Column(name="ID")
public int getMallid() {
    return mallid;
}
项目:lemon    文件:OfficesupplyInfo.java   
/** @return null. */
@Id
@Column(name = "ID", unique = true, nullable = false)
public Long getId() {
    return this.id;
}
项目:lemon    文件:PlmIssue.java   
/** @return null. */
@Id
@Column(name = "ID", unique = true, nullable = false)
public Long getId() {
    return this.id;
}
项目:tap17-muggl-javaee    文件:CustomerOrder.java   
@Id
public int getOrderId() {
    return orderId;
}
项目:lemon    文件:PortalRef.java   
/** @return null. */
@Id
@Column(name = "ID", unique = true, nullable = false)
public Long getId() {
    return this.id;
}
项目:sjk    文件:MonApp.java   
@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "Id", unique = true, nullable = false)
public Integer getId() {
    return this.id;
}
项目:lemon    文件:WhitelistInfo.java   
/** @return null. */
@Id
@Column(name = "ID", unique = true, nullable = false)
public Long getId() {
    return this.id;
}
项目:sjk    文件:Market.java   
@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "Id", unique = true, nullable = false)
public Integer getId() {
    return this.id;
}
项目:lemon    文件:PortalWidget.java   
/** @return null. */
@Id
@Column(name = "ID", unique = true, nullable = false)
public Long getId() {
    return this.id;
}
项目:lemon    文件:DoorInfo.java   
/** @return null. */
@Id
@Column(name = "ID", unique = true, nullable = false)
public Long getId() {
    return this.id;
}
项目:Spring-5.0-Cookbook    文件:Department.java   
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
public Integer getId() {
    return id;
}
项目:sjk    文件:AndroidApp.java   
@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "ID", unique = true, nullable = false)
public Integer getId() {
    return this.id;
}
项目:lemon    文件:AccountLockLog.java   
/** @return null. */
@Id
@Column(name = "ID", unique = true, nullable = false)
public Long getId() {
    return this.id;
}
项目:Spring-5.0-Cookbook    文件:Employee.java   
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
public Integer getId() {
    return id;
}
项目:lemon    文件:JavamailAttachment.java   
/** @return null. */
@Id
@Column(name = "ID", unique = true, nullable = false)
public Long getId() {
    return this.id;
}
项目:Spring-5.0-Cookbook    文件:Department.java   
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
public Integer getId() {
    return id;
}
项目:sjk    文件:App.java   
@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "Id", unique = true, nullable = false)
public int getId() {
    return id;
}
项目:lemon    文件:OrgDepartment.java   
/** @return null. */
@Id
@Column(name = "ID", unique = true, nullable = false)
public Long getId() {
    return this.id;
}
项目:lemon    文件:PimPlan.java   
/** @return null. */
@Id
@Column(name = "ID", unique = true, nullable = false)
public Long getId() {
    return this.id;
}
项目:Spring-5.0-Cookbook    文件:Employee.java   
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
public Integer getId() {
    return id;
}