日期:2014-05-17 浏览次数:20792 次
@Entity
@Table(name="t_user")
public class User implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int id;
@Column(name="name")
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
@Override
public int hashCode() {
int hash = 0;
hash += (int) id;
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof User)) {
return false;
}
User other = (User) object;
if (this.id != other.id) {
return false;
}
return true;
}
@Override
public String toString() {
return "demo.model.User[ id=" + id + " ]";
}
}
@Stateless(name="userDao",mappedName="userDao")
@Remote(UserDao.class)
@TransactionManagement(TransactionManagementType.CONTAINER)
public class UserDaoImpl implements UserDao{
@PersistenceContext(name="ThirdDemoPU")
private EntityManager manager;