package com.SAFAS.mobilecatch.server.hibernate.model;
/**
* V4cDiseasesprevention entity.
*
* @author MyEclipse Persistence Tools
*/
public class V4cDiseasesprevention implements java.io.Serializable {
// Fields
private V4cDiseasespreventionId id;
// Constructors
/** default constructor */
public V4cDiseasesprevention() {
}
/** full constructor */
public V4cDiseasesprevention(V4cDiseasespreventionId id) {
this.id = id;
}
// Property accessors
public V4cDiseasespreventionId getId() {
return this.id;
}
public void setId(V4cDiseasespreventionId id) {
this.id = id;
}
}
package com.SAFAS.mobilecatch.server.hibernate.model;
/**
* V4cDiseasespreventionId entity.
*
* @author MyEclipse Persistence Tools
*/
public class V4cDiseasespreventionId implements java.io.Serializable {
// Fields
private Integer produceClassify4id;
private String produceClassify4name;
private Short qualityStandardId;
private Short environmentStandardId;
private Short producingRuleId;
private Short produceSampleStandardId;
private String producingRuleCode;
private String producingRuleName;
private String remark;
private String pesticideName;
private String preventionMethod;
// Constructors
/** default constructor */
public V4cDiseasespreventionId() {
}
/** minimal constructor */
public V4cDiseasespreventionId(Integer produceClassify4id) {
this.produceClassify4id = produceClassify4id;
}
/** full constructor */
public V4cDiseasespreventionId(Integer produceClassify4id,
String produceClassify4name, Short qualityStandardId,
Short environmentStandardId, Short producingRuleId,
Short produceSampleStandardId, String producingRuleCode,
String producingRuleName, String remark, String pesticideName,
String preventionMethod) {
this.produceClassify4id = produceClassify4id;
this.produceClassify4name = produceClassify4name;
this.qualityStandardId = qualityStandardId;
this.environmentStandardId = environmentStandardId;
this.producingRuleId = producingRuleId;
this.produceSampleStandardId = produceSampleStandardId;
this.producingRuleCode = producingRuleCode;
this.producingRuleName = producingRuleName;
this.remark = remark;
this.pesticideName = pesticideName;
this.preventionMethod = preventionMethod;
}
// Property accessors
public Integer getProduceClassify4id() {
return this.produceClassify4id;
}
public void setProduceClassify4id(Integer produceClassify4id) {
this.produceClassify4id = produceClassify4id;
}
public String getProduceClassify4name() {
return this.produceClassify4name;
}
public void setProduceClassify4name(String produceClassify4name) {
this.produceClassify4name = produceClassify4name;
}
public Short getQualityStandardId() {
return this.qualityStandardId;
}
public void setQualityStandardId(Short qualityStandardId) {
this.qualityStandardId = qualityStandardId;
}
public Short getEnvironmentStandardId() {
return this.environmentStandardId;
}
public void setEnvironmentStandardId(Short environmentStandardId) {
this.environmentStandardId = environmentStandardId;
}
public Short getProducingRuleId() {
return this.producingRuleId;
}
public void setProducingRuleId(Short producingRuleId) {
this.producingRuleId = producingRuleId;
}
public Short getProduceSampleStandardId() {
return this.produceSampleStandardId;
}
public void setProduceSampleStandardId(Short produceSampleStandardId) {
this.produceSampleStandardId = produceSampleStandardId;
}
public String getProducingRuleCode() {
return this.producingRuleCode;
}
public void setProducingRuleCode(String producingRuleCode) {
this.producingRuleCode = producingRuleCode;
}
public String getProducingRuleName() {
return this.producingRuleName;
}
public void setProducingRuleName(String producingRuleName) {
this.producingRuleName = producingRuleName;
}
public String getRemark() {
return this.remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public String getPesticideName() {
return this.pesticideName;
}
public void setPesticideName(String pesticideName) {
this.pesticideName = pesticideName;
}
public String getPreventionMethod() {
return this.preventionMethod;
}
public void setPreventionMethod(String preventionMethod) {
this.preventionMethod = preventionMethod;
}
public boolean equals(Object other) {
if ((this == other))
return true;
if ((other == null))
return false;
if (!(other instanceof V4cDiseasespreventionId))
return false;
V4cDiseasespreventionId castOther = (V4cDiseasespreventionId) other;
return ((this.getProduceClassify4id() == castOther
.getProduceClassify4id()) || (this.getProduceClassify4id() != null
&& castOther.getProduceClassify4id() != null && this
.getProduceClassify4id().equals(
castOther.getProduceClassify4id())))
&& ((this.getProduceClassify4name() == castOther
.getProduceClassify4name()) || (this
.getProduceClassify4name() != null
&& castOther.getProduceClassify4name() != null && this
.getProduceClassify4name().equals(
castOther.getProduceClassify4name())))
&& ((this.getQualityStandardId() == castOther
.getQualityStandardId()) || (this
.getQualityStandardId() != null
&& castOther.getQualityStandardId() != null && this
.getQualityStandardId().equals(
castOther.getQualityStandardId())))
&& ((this.getEnvironmentStandardId() == castOther
.getEnvironmentStandardId()) || (this
.getEnvironmentStandardId() != null
&& castOther.getEnvironmentStandardId() != null && this
.getEnvironmentStandardId().equals(
castOther.getEnvironmentStandardId())))
&& ((this.getProducingRuleId() == castOther
.getProducingRuleId()) || (this.getProducingRuleId() != null
&& castOther.getProducingRuleId() != null && this
.getProducingRuleId().equals(
castOther.getProducingRuleId())))
&& ((this.getProduceSampleStandardId() == castOther
.getProduceSampleStandardId()) || (this
.getProduceSampleStandardId() != null
&& castOther.getProduceSampleStandardId() != null && this
.getProduceSampleStandardId().equals(
castOther.getProduceSampleStandardId())))
&& ((this.getProducingRuleCode() == castOther
.getProducingRuleCode()) || (this
.getProducingRuleCode() != null
&& castOther.getProducingRuleCode() != null && this
.getProducingRuleCode().equals(
castOther.getProducingRuleCode())))
&& ((this.getProducingRuleName() == castOther
.getProducingRuleName()) || (this
.getProducingRuleName() != null
&& castOther.getProducingRuleName() != null && this
.getProducingRuleName().equals(
castOther.getProducingRuleName())))
&& ((this.getRemark() == castOther.getRemark()) || (this
.getRemark() != null
&& castOther.getRemark() != null && this.getRemark()
.equals(castOther.getRemark())))
&& ((this.getPesticideName() == castOther.getPesticideName()) || (this
.getPesticideName() != null
&& castOther.getPesticideName() != null && this
.getPesticideName()
.equals(castOther.getPesticideName())))
&& ((this.getPreventionMethod() == castOther
.getPreventionMethod()) || (this.getPreventionMethod() != null
&& castOther.getPreventionMethod() != null && this
.getPreventionMethod().equals(
castOther.getPreventionMethod())));
}
public int hashCode() {
int result = 17;
result = 37
* result
+ (getProduceClassify4id() == null ? 0 : this
.getProduceClassify4id().hashCode());
result = 37
* result
+ (getProduceClassify4name() == null ? 0 : this
.getProduceClassify4name().hashCode());
result = 37
* result
+ (getQualityStandardId() == null ? 0 : this
.getQualityStandardId().hashCode());
result = 37
* result
+ (getEnvironmentStandardId() == null ? 0 : this
.getEnvironmentStandardId().hashCode());
result = 37
* result
+ (getProducingRuleId() == null ? 0 : this.getProducingRuleId()
.hashCode());
result = 37
* result
+ (getProduceSampleStandardId() == null ? 0 : this
.getProduceSampleStandardId().hashCode());
result = 37
* result
+ (getProducingRuleCode() == null ? 0 : this
.getProducingRuleCode().hashCode());
result = 37
* result
+ (getProducingRuleName() == null ? 0 : this
.getProducingRuleName().hashCode());
result = 37 * result
+ (getRemark() == null ? 0 : this.getRemark().hashCode());
result = 37
* result
+ (getPesticideName() == null ? 0 : this.getPesticideName()
.hashCode());
result = 37
* result
+ (getPreventionMethod() == null ? 0 : this
.getPreventionMethod().hashCode());
return result;
}
}
V4cDiseasesprevention.hbm.xml
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!--
Mapping file autogenerated by MyEclipse Persistence Tools
-->
<hibernate-mapping>
<class name="com.pickedpoint.SAFAS.mobilecatch.server.hibernate.model.V4cDiseasesprevention" table="v_4c_diseasesprevention" catalog="safas">
<composite-id name="id" class="com.pickedpoint.SAFAS.mobilecatch.server.hibernate.model.V4cDiseasespreventionId">
<key-property name="produceClassify4id" type="java.lang.Integer">
<column name="produceClassify_4ID" />
</key-property>
<key-property name="produceClassify4name" type="java.lang.String">
<column name="produceClassify_4Name" length="20" />
</key-property>
<key-property name="qualityStandardId" type="java.lang.Short">
<column name="qualityStandardID" />
</key-property>
<key-property name="environmentStandardId" type="java.lang.Short">
<column name="environmentStandardID" />
</key-property>
<key-property name="producingRuleId" type="java.lang.Short">
<column name="producingRuleID" />
</key-property>
<key-property name="produceSampleStandardId" type="java.lang.Short">
<column name="produceSampleStandardID" />
</key-property>
<key-property name="producingRuleCode" type="java.lang.String">
<column name="producingRuleCode" />
</key-property>
<key-property name="producingRuleName" type="java.lang.String">
<column name="producingRuleName" length="50" />
</key-property>
<key-property name="remark" type="java.lang.String">
<column name="remark" />
</key-property>
<key-property name="pesticideName" type="java.lang.String">
<column name="pesticideName" length="50" />
</key-property>
<key-property name="preventionMethod" type="java.lang.String">
<column name="preventionMethod" />
</key-property>
</composite-id>
</class>
</hibernate-mapping>
public List Query(){
Session session = HibernateSessionFactory.getSession();
Query query = session.createQuery("from V4cDiseasesprevention");
List list = query.list();
if(session.isOpen()){
session.close();
}
return list;
}
public List QueryByName(String produceClassify4name){
Session session = HibernateSessionFactory.getSession();
Query query = session.createQuery("from V4cDiseasesprevention where produceClassify4name = '" + produceClassify4name + "'");
List list = query.list();
if(session.isOpen()){
session.close();
}
return list;
}//不要使用别名~
//或者
public List QueryByName(String produceClassify4name){
Session session = HibernateSessionFactory.getSession();
Query query = session.createQuery("from V4cDiseasesprevention v where v.id.produceClassify4name = '" + produceClassify4name + "'");
List list = query.list();
if(session.isOpen()){
session.close();
}
return list;
}