I have a group of legacy tables and used Middlegen to get the mappings
one of which is something like this
<class name="ejb.Purchase" table="PURCHASE">
<composite-id name="id" class="ejb.PurchasePK">
<key-property name="number" column="NUMBER" type="string"/>
<key-property name="branch" column="BRANCH" type="string" />
</composite-id>
<property name="other" type="string" column="OTHER"/>
</class>
I know the design sucks but I have
my problem is that when I try to use:
PurchasePK id=new PurchasePK("1","10");
Purchase p=(Purchase)session.load(Purchase.class,id) I get a row not found error
but if I submit something like this:
String query="from Purchase pur where pur.id.number=1
and pur.id=10"
List l=session.find(query);
p=(Purchase)l.get(o);
and I get the id from this object
PurchasePK id2=p.getId();
id2.equals(id) returns false.
I am using Oracle9i and the type fields from the composite are of type varchar2
also I am pretty sure that I had this working before I made some changes
I am stuck with it and I will appreciate some help
thanks
|