luckydexte
Programmer
Hello all,
I am new to Hibernate and I am getting an error that I cannot seem to resolve. Below is the hbm.xml file, the java class, and a little utility to run the code. I am printing the SQL code and when I run it in SQL plus I get the expected results but it will not load when I call my class. Any help would be greatly appreciated.
Note, I have elimated some of the table names to make the code shorter by using @@ where I have taken something out.
hbm.xml file:
<hibernate-mapping>
<class name="@@.IndGeneralSite" table="@@IND_SITE">
<composite-id>
<key-property name="permitNumber"
column="PERMIT_NO" type="java.lang.Integer" />
<key-property name="siteNumber"
column="SITE_NO" type="java.lang.Integer" />
</composite-id>
<set name="patches" order-by="PATCH_NO"
fetch="subselect" mutable="false" >
<key update="false">
<column name="PERMIT_NO" />
<column name="SITE_NO" />
</key>
<one-to-many class="@@.IndGeneralPatch" />
</set>
// A list of other fields omitted
</hibernate-mapping>
.java file
public class IndGeneralSite extends ActionForm {
private Integer permitNumber;
private Integer siteNumber;
private Set patches = new HashSet();
public Integer getPermitNumber() { return permitNumber; }
public Integer getSiteNumber() { return siteNumber; }
public Set getPatches() { return patches; }
public void setPermitNumber(Integer i) {permitNumber=i;}
public void setSiteNumber(Integer i) {siteNumber = i;}
public void setPatches(Set patches) { this.patches = patches; }
Utility to print the hash set (patches)
IndPermitFunctions pf = new IndPermitFunctions();
IndGeneralPermit igp = pf.getPermit("565719");
IndGeneralSite igs = pf.getSite("565719", "2");
HashSet col = new HashSet(igs.getPatches());
Iterator iterator = col.iterator();
while (iterator.hasNext()){ // Does not get into
System.err.print(iterator.next() + "\n ");
}
System.err.println("patches are " + igs.getPatches());
Output:
[7/26/07 ] 3da068ad SystemErr R patches are []
However, when I run the SQL statement it generates I get the expected result. Any ideas? Thanks again.
Brandon
I am new to Hibernate and I am getting an error that I cannot seem to resolve. Below is the hbm.xml file, the java class, and a little utility to run the code. I am printing the SQL code and when I run it in SQL plus I get the expected results but it will not load when I call my class. Any help would be greatly appreciated.
Note, I have elimated some of the table names to make the code shorter by using @@ where I have taken something out.
hbm.xml file:
<hibernate-mapping>
<class name="@@.IndGeneralSite" table="@@IND_SITE">
<composite-id>
<key-property name="permitNumber"
column="PERMIT_NO" type="java.lang.Integer" />
<key-property name="siteNumber"
column="SITE_NO" type="java.lang.Integer" />
</composite-id>
<set name="patches" order-by="PATCH_NO"
fetch="subselect" mutable="false" >
<key update="false">
<column name="PERMIT_NO" />
<column name="SITE_NO" />
</key>
<one-to-many class="@@.IndGeneralPatch" />
</set>
// A list of other fields omitted
</hibernate-mapping>
.java file
public class IndGeneralSite extends ActionForm {
private Integer permitNumber;
private Integer siteNumber;
private Set patches = new HashSet();
public Integer getPermitNumber() { return permitNumber; }
public Integer getSiteNumber() { return siteNumber; }
public Set getPatches() { return patches; }
public void setPermitNumber(Integer i) {permitNumber=i;}
public void setSiteNumber(Integer i) {siteNumber = i;}
public void setPatches(Set patches) { this.patches = patches; }
Utility to print the hash set (patches)
IndPermitFunctions pf = new IndPermitFunctions();
IndGeneralPermit igp = pf.getPermit("565719");
IndGeneralSite igs = pf.getSite("565719", "2");
HashSet col = new HashSet(igs.getPatches());
Iterator iterator = col.iterator();
while (iterator.hasNext()){ // Does not get into
System.err.print(iterator.next() + "\n ");
}
System.err.println("patches are " + igs.getPatches());
Output:
[7/26/07 ] 3da068ad SystemErr R patches are []
However, when I run the SQL statement it generates I get the expected result. Any ideas? Thanks again.
Brandon