为什么我的hibernate元模型 获取类的字段为空呢
i use hibernate-jpamodelgen-1.2.0.Final.jar tool in javaee6 Environment to produce Meta Model class.
but when i test
*/
public static void main(String[] args) {
System.out.println(Models_.modelName);
} why i get null?
myrun Environment is
hibernate-commons-annotations-4.0.2.Final.jar
hibernate-core-4.3.0.Beta3.jar
hibernate-entitymanager-4.3.0.Beta3.jar
hibernate-jpa-2.1-api-1.0.0.Draft-16.jar
can any help me ? thanks very much
@Entity
@Table(name = "et_models")
@XmlRootElement
@NamedQueries({
@NamedQuery(name = "Models.findAll", query = "SELECT m FROM Models m"),
@NamedQuery(name = "Models.findByModelName", query = "SELECT m FROM Models m WHERE m.modelName = :modelName"),
@NamedQuery(name = "Models.findByModelDesc", query = "SELECT m FROM Models m WHERE m.modelDesc = :modelDesc"),
@NamedQuery(name = "Models.findByServerCodeBase", query = "SELECT m FROM Models m WHERE m.serverCodeBase = :serverCodeBase"),
@NamedQuery(name = "Models.findByClientCodeBase", query = "SELECT m FROM Models m WHERE m.clientCodeBase = :clientCodeBase"),
@NamedQuery(name = "Models.findByLoaderCodeBase", query = "SELECT m FROM Models m WHERE m.loaderCodeBase = :loaderCodeBase"),
@NamedQuery(name = "Models.findByImporterCodeBase", query = "SELECT m FROM Models m WHERE m.importerCodeBase = :importerCodeBase"),
@NamedQuery(name = "Models.findByCacheCodeBase", query = "SELECT m FROM Models m WHERE m.cacheCodeBase = :cacheCodeBase"),
@NamedQuery(name = "Models.findByCreatedBy", query = "SELECT m FROM Models m WHERE m.createdBy = :createdBy"),
@NamedQuery(name = "Models.findByCreationDate", query = "SELECT m FROM Models m WHERE m.creationDate = :creationDate"),
@NamedQuery(name = "Models.findByLastUpdatedBy", query = "SELECT m FROM Models m WHERE m.lastUpdatedBy = :lastUpdatedBy"),
@NamedQuery(name = "Models.findByLastUpdateDate", query = "SELECT m FROM Models m WHERE m.lastUpdateDate = :lastUpdateDate"),
@NamedQuery(name = "Models.findByLastUpdateLogin", query = "SELECT m FROM Models m WHERE m.lastUpdateLogin = :lastUpdateLogin")})
public class Models implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Basic(optional = false)
@Column(name = "model_name")
private String modelName;
@Basic(optional = false)
@Column(name = "model_desc")
private String modelDesc;
@Column(name = "server_code_base")
private String serverCodeBase;
@Column(name = "client_code_base")
private String clientCodeBase;
@Column(name = "loader_code_base")
private String loaderCodeBase;
@Column(name = "importer_code_base")
private String importerCodeBase;
@Column(name = "cache_code_base")
private String cacheCodeBase;
@Basic(optional = false)
@Column(name = "created_by")
private long createdBy;
@Basic(optional = false)
@Column(name = "creation_date")
@Temporal(TemporalType.TIMESTAMP)
private Date creationDate;
@Basic(optional = false)
@Column(name = "last_updated_by")
private long lastUpdatedBy;
@Basic(optional = false)
@Column(name = "last_update_date")
@Temporal(TemporalType.TIMESTAMP)
private Date lastUpdateDate;
@Basic(optional = false)
@Column(name = "last_update_login")
private long lastUpdateLogin;
@OneToMany(mappedBy = "modelName")
// @XmlElement(name="codingSchemesList")
private List<CodingSchemes> codingSchemesList;
public Models() {
}
public Models(String modelName) {
this.modelName = modelName;
}
public Models(String modelName, String modelDesc, long createdBy, Date creationDate, long lastUpdatedBy, Date lastUpdateDate, long lastUpdateLogin) {
this.modelName = modelName;
this.modelDesc = modelDesc;
this.createdBy = createdBy;
this.creationDate = creationDate;
this.lastUpdatedBy = lastUpdatedBy;
this.lastUpdateDate = lastUpdateDate;
this.lastUpdateLogin = lastUpdateLogin;
}
.............................................
@Generated(value = "org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor")
@StaticMetamodel(Models.class)
public abstract class Models_ {
public static volatile SingularAttribute<Models, Date> creationDate;
public static volatile ListAttribute<Models, CodingSchemes> codingSchemesList;
public static volatile SingularAttribute<Models, String> modelName;
public static volatile SingularAttribute<Models, Long> createdBy;
public static volatile SingularAttribute<Models, String> importerCodeBase;
public static volatile SingularAttribute<Models, Long> lastUpdateLogin;
public static volatile SingularAttribute<Models, Long> lastUpdatedBy;
public static volatile SingularAttribute<Models, String> modelDesc;
public static volatile SingularAttribute<Models, String> loaderCodeBase;
public static volatile SingularAttribute<Models, String> cacheCodeBase;
public static volatile SingularAttribute<Models, String> serverCodeBase;
public static volatile SingularAttribute<Models, String> clientCodeBase;
public static volatile SingularAttribute<Models, Date> lastUpdateDate;
}