Hibernate - Annotation String as Id (Primary Key)

 

 


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;

/**
* User Pending approvals
*
*/

@Entity
@Table
public class UserApproval implements Serializable {

private String username; 
private String pendingApprovals ; 


@Id
@GenericGenerator(name = "idGenerator", strategy = "assigned")
@GeneratedValue(generator = "idGenerator")
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}

public String getPendingApprovals() {
return pendingApprovals;
}
public void setPendingApprovals(String pendingApprovals) {
this.pendingApprovals = pendingApprovals;
}

}

 

 

posted @ 2013-09-24 18:34  makemelike  阅读(229)  评论(0编辑  收藏  举报