java类javax.persistence.Id的实例源码

User.java 文件源码 项目:wangmarket 阅读 34 收藏 0 点赞 0 评论 0
/**
 * 用户id
 * @return
 */
@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "id", unique = true, nullable = false)
public Integer getId() {
    return this.id;
}
JPAOverriddenAnnotationReader.java 文件源码 项目:lams 阅读 37 收藏 0 点赞 0 评论 0
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 );
}
EntityRefelectUtils.java 文件源码 项目:FastSQL 阅读 46 收藏 0 点赞 0 评论 0
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);
}
User8JPA.java 文件源码 项目:tinyshop8 阅读 34 收藏 0 点赞 0 评论 0
@Id
@GeneratedValue
@Override
public Long getId()
{
    return super.getId();
}
TopicView.java 文件源码 项目:uckefu 阅读 42 收藏 0 点赞 0 评论 0
@Id
@Column(length = 32)
@GeneratedValue(generator = "system-uuid")
@GenericGenerator(name = "system-uuid", strategy = "uuid")  
public String getId() {
    return id;
}
Power.java 文件源码 项目:hibernateMaster 阅读 38 收藏 0 点赞 0 评论 0
@Id
@GenericGenerator(name="generator",strategy="assigned")
@GeneratedValue(generator="generator")
@Column(length=32)
public String getName() {
    return name;
}
JPAOverriddenAnnotationReader.java 文件源码 项目:lams 阅读 35 收藏 0 点赞 0 评论 0
/**
 * 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 ) );
    }
}
GoodsBrand8JPA.java 文件源码 项目:tinyshop8 阅读 38 收藏 0 点赞 0 评论 0
@Column(name = "brand_id")
@Override
@Id
@GeneratedValue
public Long getId()
{
    return super.getId();
}
Log.java 文件源码 项目:wangmarket 阅读 40 收藏 0 点赞 0 评论 0
@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "id", unique = true, nullable = false)
public Integer getId() {
    return id;
}
Payment.java 文件源码 项目:Hotel-Properties-Management-System 阅读 33 收藏 0 点赞 0 评论 0
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;
}
DomainUtil.java 文件源码 项目:hibernateMaster 阅读 38 收藏 0 点赞 0 评论 0
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;
}
User.java 文件源码 项目:Hotel-Properties-Management-System 阅读 39 收藏 0 点赞 0 评论 0
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;
}
Order.java 文件源码 项目:GitHub 阅读 47 收藏 0 点赞 0 评论 0
@Id @GeneratedValue(strategy=IDENTITY)

@Column(name="orderNumber", unique=true, nullable=false)
public Integer getOrderNumber() {
    return this.orderNumber;
}
Metro.java 文件源码 项目:sjk 阅读 42 收藏 0 点赞 0 评论 0
@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "Id", unique = true, nullable = false)
public Integer getId() {
    return this.id;
}
PermType.java 文件源码 项目:lemon 阅读 35 收藏 0 点赞 0 评论 0
/** @return 主键. */
@Id
@Column(name = "ID", unique = true, nullable = false)
public Long getId() {
    return this.id;
}
AccountOnline.java 文件源码 项目:lemon 阅读 34 收藏 0 点赞 0 评论 0
/** @return null. */
@Id
@Column(name = "ID", unique = true, nullable = false)
public Long getId() {
    return this.id;
}
TicketCatalog.java 文件源码 项目:lemon 阅读 35 收藏 0 点赞 0 评论 0
/** @return null. */
@Id
@Column(name = "ID", unique = true, nullable = false)
public Long getId() {
    return this.id;
}
SendmailAttachment.java 文件源码 项目:lemon 阅读 33 收藏 0 点赞 0 评论 0
/** @return null. */
@Id
@Column(name = "ID", unique = true, nullable = false)
public Long getId() {
    return this.id;
}
Employee.java 文件源码 项目:incubator-netbeans 阅读 37 收藏 0 点赞 0 评论 0
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
public Long getId() {
    return id;
}
BpmConfForm.java 文件源码 项目:lemon 阅读 34 收藏 0 点赞 0 评论 0
/** @return 主键. */
@Id
@Column(name = "ID", unique = true, nullable = false)
public Long getId() {
    return this.id;
}
newMall.java 文件源码 项目:Hibernate_HQL_UniqueResult_ExecuteUpdate_CopyData_Delete_Update 阅读 63 收藏 0 点赞 0 评论 0
@Id 
@Column(name="ID")
public int getMallid() {
    return mallid;
}
OfficesupplyInfo.java 文件源码 项目:lemon 阅读 35 收藏 0 点赞 0 评论 0
/** @return null. */
@Id
@Column(name = "ID", unique = true, nullable = false)
public Long getId() {
    return this.id;
}
PlmIssue.java 文件源码 项目:lemon 阅读 41 收藏 0 点赞 0 评论 0
/** @return null. */
@Id
@Column(name = "ID", unique = true, nullable = false)
public Long getId() {
    return this.id;
}
CustomerOrder.java 文件源码 项目:tap17-muggl-javaee 阅读 39 收藏 0 点赞 0 评论 0
@Id
public int getOrderId() {
    return orderId;
}
PortalRef.java 文件源码 项目:lemon 阅读 35 收藏 0 点赞 0 评论 0
/** @return null. */
@Id
@Column(name = "ID", unique = true, nullable = false)
public Long getId() {
    return this.id;
}
MonApp.java 文件源码 项目:sjk 阅读 40 收藏 0 点赞 0 评论 0
@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "Id", unique = true, nullable = false)
public Integer getId() {
    return this.id;
}
WhitelistInfo.java 文件源码 项目:lemon 阅读 35 收藏 0 点赞 0 评论 0
/** @return null. */
@Id
@Column(name = "ID", unique = true, nullable = false)
public Long getId() {
    return this.id;
}
Market.java 文件源码 项目:sjk 阅读 37 收藏 0 点赞 0 评论 0
@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "Id", unique = true, nullable = false)
public Integer getId() {
    return this.id;
}
PortalWidget.java 文件源码 项目:lemon 阅读 34 收藏 0 点赞 0 评论 0
/** @return null. */
@Id
@Column(name = "ID", unique = true, nullable = false)
public Long getId() {
    return this.id;
}
DoorInfo.java 文件源码 项目:lemon 阅读 41 收藏 0 点赞 0 评论 0
/** @return null. */
@Id
@Column(name = "ID", unique = true, nullable = false)
public Long getId() {
    return this.id;
}


问题


面经


文章

微信
公众号

扫码关注公众号