hi, i reversed a database using middlegen (see .java and .hbm.xml files below). seems sorta normal (but i am a programmer, not a dba) and i get a:
INFO: building session factory
net.sf.hibernate.PropertyNotFoundException: Could not find a getter for pEntId in class fg1.hibernate.EntityNum
at net.sf.hibernate.property.BasicPropertyAccessor.getGetter(BasicPropertyAccessor.java:182)
at net.sf.hibernate.mapping.Property.getGetter(Property.java:179) ...
the rest of the classes generated by niddlegen can be added to the configuration and the session get's built.
any pointers will be appreciated.
thanks
package fg1.hibernate;
import java.io.Serializable;
import java.util.Date;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
/** @author Hibernate CodeGenerator */
public class EntityNum implements Serializable {
/** identifier field */
private Integer dbId;
/** persistent field */
private String myEntId;
/** persistent field */
private String pEntId;
/** persistent field */
private String pEntRole;
/** persistent field */
private String pEntNum;
/** persistent field */
private String whoCreated;
/** persistent field */
private Date whenCreated;
/** nullable persistent field */
private String whoModified;
/** nullable persistent field */
private Date whenModified;
/** full constructor */
public EntityNum(Integer dbId, String myEntId, String pEntId, String pEntRole, String pEntNum, String whoCreated, Date whenCreated, String whoModified, Date whenModified) {
this.dbId = dbId;
this.myEntId = myEntId;
this.pEntId = pEntId;
this.pEntRole = pEntRole;
this.pEntNum = pEntNum;
this.whoCreated = whoCreated;
this.whenCreated = whenCreated;
this.whoModified = whoModified;
this.whenModified = whenModified;
}
/** default constructor */
public EntityNum() {
}
/** minimal constructor */
public EntityNum(Integer dbId, String myEntId, String pEntId, String pEntRole, String pEntNum, String whoCreated, Date whenCreated) {
this.dbId = dbId;
this.myEntId = myEntId;
this.pEntId = pEntId;
this.pEntRole = pEntRole;
this.pEntNum = pEntNum;
this.whoCreated = whoCreated;
this.whenCreated = whenCreated;
}
public Integer getDbId() {
return this.dbId;
}
public void setDbId(Integer dbId) {
this.dbId = dbId;
}
public String getMyEntId() {
return this.myEntId;
}
public void setMyEntId(String myEntId) {
this.myEntId = myEntId;
}
public String getPEntId() {
return this.pEntId;
}
public void setPEntId(String pEntId) {
this.pEntId = pEntId;
}
public String getPEntRole() {
return this.pEntRole;
}
public void setPEntRole(String pEntRole) {
this.pEntRole = pEntRole;
}
public String getPEntNum() {
return this.pEntNum;
}
public void setPEntNum(String pEntNum) {
this.pEntNum = pEntNum;
}
public String getWhoCreated() {
return this.whoCreated;
}
public void setWhoCreated(String whoCreated) {
this.whoCreated = whoCreated;
}
public Date getWhenCreated() {
return this.whenCreated;
}
public void setWhenCreated(Date whenCreated) {
this.whenCreated = whenCreated;
}
public String getWhoModified() {
return this.whoModified;
}
public void setWhoModified(String whoModified) {
this.whoModified = whoModified;
}
public Date getWhenModified() {
return this.whenModified;
}
public void setWhenModified(Date whenModified) {
this.whenModified = whenModified;
}
public String toString() {
return new ToStringBuilder(this)
.append("dbId", getDbId())
.toString();
}
public boolean equals(Object other) {
if ( !(other instanceof EntityNum) ) return false;
EntityNum castOther = (EntityNum) other;
return new EqualsBuilder()
.append(this.getDbId(), castOther.getDbId())
.isEquals();
}
public int hashCode() {
return new HashCodeBuilder()
.append(getDbId())
.toHashCode();
}
}
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >
<hibernate-mapping>
<!--
Created by the Middlegen Hibernate plugin
http://boss.bekk.no/boss/middlegen/
http://hibernate.sourceforge.net/
-->
<class
name="fg1.hibernate.EntityNum"
table="entity_num"
>
<id
name="dbId"
type="int"
column="db_id"
>
<generator class="assigned" />
</id>
<property
name="myEntId"
type="java.lang.String"
column="my_ent_id"
not-null="true"
unique="true"
length="40"
/>
<property
name="pEntId"
type="java.lang.String"
column="p_ent_id"
not-null="true"
unique="true"
length="40"
/>
<property
name="pEntRole"
type="java.lang.String"
column="p_ent_role"
not-null="true"
unique="true"
length="10"
/>
<property
name="pEntNum"
type="java.lang.String"
column="p_ent_num"
not-null="true"
unique="true"
length="40"
/>
<property
name="whoCreated"
type="java.lang.String"
column="who_created"
not-null="true"
length="10"
/>
<property
name="whenCreated"
type="java.sql.Timestamp"
column="when_created"
not-null="true"
length="19"
/>
<property
name="whoModified"
type="java.lang.String"
column="who_modified"
length="10"
/>
<property
name="whenModified"
type="java.sql.Timestamp"
column="when_modified"
length="14"
/>
<!-- associations -->
</class>
</hibernate-mapping>