“数据库中的实体类”在Netbeans中受支持但是在eclipse Indigo中我尝试了很多,但除了JPA的实体类之外没有找到任何方法,我想为动态web项目(struts2)为hibernate创建实体类
Netbeans可以像这样创建但是为什么eclipse不能以这种方式创建“来自数据库的实体类”
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package temp;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
/**
*
* @author Shakeel
*/
@Entity
@Table(name = "email")
@XmlRootElement
@NamedQueries({
@NamedQuery(name = "Email.findAll", query = "SELECT e FROM Email e"),
@NamedQuery(name = "Email.findByEmailId", query = "SELECT e FROM Email e WHERE e.emailId = :emailId"),
@NamedQuery(name = "Email.findByUserId", query = "SELECT e FROM Email e WHERE e.userId = :userId"),
@NamedQuery(name = "Email.findByEmailAddress", query = "SELECT e FROM Email e WHERE e.emailAddress = :emailAddress")})
public class Email implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "email_id")
private Integer emailId;
@Column(name = "user_id")
private Integer userId;
@Column(name = "email_address")
private String emailAddress;
public Email() {
}
//all gatter and setter
}