ejb源代码
源代码在线查看: user2.java
package com.bjsxt.ejb.id;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;
@Entity
@Table(name="T_User2")
public class User2 implements Serializable{
/**
* 可以将ID的生成策略定义为UUID,这时候,ID的生成策略将跟hibernate绑定
*/
@Id
@GeneratedValue(generator="hibernateuuidgenerator")
@GenericGenerator(name="hibernateuuidgenerator",strategy="uuid")
private String id;
private String username;
private String password;
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
}