当前位置: 首页>>代码示例>>Java>>正文


Java Id类代码示例

本文整理汇总了Java中javax.persistence.Id的典型用法代码示例。如果您正苦于以下问题:Java Id类的具体用法?Java Id怎么用?Java Id使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Id类属于javax.persistence包,在下文中一共展示了Id类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getId

import javax.persistence.Id; //导入依赖的package包/类
/**
 * 用户id
 * @return
 */
@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "id", unique = true, nullable = false)
public Integer getId() {
	return this.id;
}
 
开发者ID:xnx3,项目名称:wangmarket,代码行数:11,代码来源:User.java

示例2: getId

import javax.persistence.Id; //导入依赖的package包/类
@Id
@Column(length = 32)
@GeneratedValue(generator = "system-uuid")
@GenericGenerator(name = "system-uuid", strategy = "uuid")	
public String getId() {
	return id;
}
 
开发者ID:uckefu,项目名称:uckefu,代码行数:8,代码来源:TopicView.java

示例3: isProcessingId

import javax.persistence.Id; //导入依赖的package包/类
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 );
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:18,代码来源:JPAOverriddenAnnotationReader.java

示例4: getIdField

import javax.persistence.Id; //导入依赖的package包/类
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);
}
 
开发者ID:fast-sql,项目名称:FastSQL,代码行数:18,代码来源:EntityRefelectUtils.java

示例5: getId

import javax.persistence.Id; //导入依赖的package包/类
@Id
@GeneratedValue
@Override
public Long getId()
{
    return super.getId();
}
 
开发者ID:SessionFactory,项目名称:tinyshop8,代码行数:8,代码来源:User8JPA.java

示例6: getName

import javax.persistence.Id; //导入依赖的package包/类
@Id
@GenericGenerator(name="generator",strategy="assigned")
@GeneratedValue(generator="generator")
@Column(length=32)
public String getName() {
	return name;
}
 
开发者ID:battlesteed,项目名称:hibernateMaster,代码行数:8,代码来源:Power.java

示例7: getAssociationId

import javax.persistence.Id; //导入依赖的package包/类
/**
 * 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 ) );
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:13,代码来源:JPAOverriddenAnnotationReader.java

示例8: getId

import javax.persistence.Id; //导入依赖的package包/类
@Column(name = "brand_id")
@Override
@Id
@GeneratedValue
public Long getId()
{
    return super.getId();
}
 
开发者ID:SessionFactory,项目名称:tinyshop8,代码行数:9,代码来源:GoodsBrand8JPA.java

示例9: getId

import javax.persistence.Id; //导入依赖的package包/类
@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "id", unique = true, nullable = false)
public Integer getId() {
	return id;
}
 
开发者ID:xnx3,项目名称:wangmarket,代码行数:7,代码来源:Log.java

示例10: Payment

import javax.persistence.Id; //导入依赖的package包/类
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;
}
 
开发者ID:Coder-ACJHP,项目名称:Hotel-Properties-Management-System,代码行数:13,代码来源:Payment.java

示例11: createIDNotfoundException

import javax.persistence.Id; //导入依赖的package包/类
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;
}
 
开发者ID:battlesteed,项目名称:hibernateMaster,代码行数:8,代码来源:DomainUtil.java

示例12: User

import javax.persistence.Id; //导入依赖的package包/类
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;
}
 
开发者ID:Coder-ACJHP,项目名称:Hotel-Properties-Management-System,代码行数:12,代码来源:User.java

示例13: getOrderNumber

import javax.persistence.Id; //导入依赖的package包/类
@Id @GeneratedValue(strategy=IDENTITY)

@Column(name="orderNumber", unique=true, nullable=false)
public Integer getOrderNumber() {
    return this.orderNumber;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:7,代码来源:Order.java

示例14: getId

import javax.persistence.Id; //导入依赖的package包/类
@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "Id", unique = true, nullable = false)
public Integer getId() {
    return this.id;
}
 
开发者ID:zhaoxi1988,项目名称:sjk,代码行数:7,代码来源:Metro.java

示例15: getId

import javax.persistence.Id; //导入依赖的package包/类
/** @return 主键. */
@Id
@Column(name = "ID", unique = true, nullable = false)
public Long getId() {
    return this.id;
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:7,代码来源:PermType.java


注:本文中的javax.persistence.Id类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。