I believe you are right -- it is not picking up on the table name because if it did, the resulting class would have been named "CompanyData" and not "Compdata", which is the name of the table. In my reverse engineer file, do I need to include the schema name in the <table name> parameter value of my reverse engineer <table-filter>
Reverse engineer file:
Code:
table-filter match-schema="FAWEB" match-name=".*"></table-filter>
<table name="COMPDATA" class="Companydata">
<primary-key>
<generator class="identity">
</generator>
<key-column name="COMPANYID"/>
</primary-key>
</table>
Here is the resulting mapping file, Compdata.hbm.xml:
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated Oct 14, 2007 6:09:13 PM by Hibernate Tools 3.2.0.b9 -->
<hibernate-mapping>
<class name="com.faweb.entities.Compdata" table="COMPDATA" schema="FAWEB" dynamic-insert="true">
<!-- dynamic-insert (optional, defaults to false): Specifies that INSERT SQL should be generated at runtime
and contain only the columns whose values are not null. -->
<id name="companyid" type="int">
<column name="COMPANYID" />
<generator class="assigned" />
</id>
<many-to-one name="contactinfo" class="com.faweb.entities.Contactinfo" fetch="select">
<column name="CONTACTID" />
</many-to-one>
<property name="companyname" type="string">
<column name="COMPANYNAME" length="50" not-null="true" />
</property>
<property name="remBal" type="big_decimal">
<column name="REM_BAL" precision="11" />
</property>
<property name="accesscode" type="string">
<column name="ACCESSCODE" length="50" />
</property>
<set name="compmsgses" inverse="true">
<key>
<column name="COMPANYID" not-null="true" />
</key>
<one-to-many class="com.faweb.entities.Compmsgs" />
</set>
<set name="compdeps" inverse="true">
<key>
<column name="COMPANYID" not-null="true" />
</key>
<one-to-many class="com.faweb.entities.Compdep" />
</set>
<set name="usrprofileses" inverse="true" table="USRPROFILES_X_COMPDATA">
<key>
<column name="COMPANYID" not-null="true" />
</key>
<many-to-many entity-name="com.faweb.entities.Usrprofiles">
<column name="UID" not-null="true" />
</many-to-many>
</set>
<set name="fratesconfigs" inverse="true">
<key>
<column name="COMPANYID" />
</key>
<one-to-many class="com.faweb.entities.Fratesconfig" />
</set>
<set name="actlogs" inverse="true">
<key>
<column name="COMPANYID" />
</key>
<one-to-many class="com.faweb.entities.Actlog" />
</set>
</class>
</hibernate-mapping>
and here is the resulting class file, Compdata.java:
Code:
/ Generated Oct 14, 2007 6:09:13 PM by Hibernate Tools 3.2.0.b9
import java.math.BigDecimal;
import java.util.HashSet;
import java.util.Set;
/**
* Compdata generated by hbm2java
*/
public class Compdata implements java.io.Serializable {
private int companyid;
private Contactinfo contactinfo;
private String companyname;
private BigDecimal remBal;
private String accesscode;
private Set compmsgses = new HashSet(0);
private Set compdeps = new HashSet(0);
private Set usrprofileses = new HashSet(0);
private Set fratesconfigs = new HashSet(0);
private Set actlogs = new HashSet(0);
public Compdata() {
}
public Compdata(int companyid, String companyname) {
this.companyid = companyid;
this.companyname = companyname;
}
public Compdata(int companyid, Contactinfo contactinfo, String companyname,
BigDecimal remBal, String accesscode, Set compmsgses, Set compdeps,
Set usrprofileses, Set fratesconfigs, Set actlogs) {
this.companyid = companyid;
this.contactinfo = contactinfo;
this.companyname = companyname;
this.remBal = remBal;
this.accesscode = accesscode;
this.compmsgses = compmsgses;
this.compdeps = compdeps;
this.usrprofileses = usrprofileses;
this.fratesconfigs = fratesconfigs;
this.actlogs = actlogs;
}
public int getCompanyid() {
return this.companyid;
}
public void setCompanyid(int companyid) {
this.companyid = companyid;
}
public Contactinfo getContactinfo() {
return this.contactinfo;
}
public void setContactinfo(Contactinfo contactinfo) {
this.contactinfo = contactinfo;
}
public String getCompanyname() {
return this.companyname;
}
public void setCompanyname(String companyname) {
this.companyname = companyname;
}
public BigDecimal getRemBal() {
return this.remBal;
}
public void setRemBal(BigDecimal remBal) {
this.remBal = remBal;
}
public String getAccesscode() {
return this.accesscode;
}
public void setAccesscode(String accesscode) {
this.accesscode = accesscode;
}
public Set getCompmsgses() {
return this.compmsgses;
}
public void setCompmsgses(Set compmsgses) {
this.compmsgses = compmsgses;
}
public Set getCompdeps() {
return this.compdeps;
}
public void setCompdeps(Set compdeps) {
this.compdeps = compdeps;
}
public Set getUsrprofileses() {
return this.usrprofileses;
}
public void setUsrprofileses(Set usrprofileses) {
this.usrprofileses = usrprofileses;
}
public Set getFratesconfigs() {
return this.fratesconfigs;
}
public void setFratesconfigs(Set fratesconfigs) {
this.fratesconfigs = fratesconfigs;
}
public Set getActlogs() {
return this.actlogs;
}
public void setActlogs(Set actlogs) {
this.actlogs = actlogs;
}
}