Using the Ant tasks for hibernate tools, I've successfully reverse engineered db2 as/400 flat files (tables).
There are no primary keys. So, what's created in the reveng tasks are "
tablename.java" and "
tablenameId.java".
tablename.java contains 1 attribute: a
tablenameId.
TablenameId contains fields for all the column names.
The
tablename.hbm.xml documents created have composite-id's which contain all the fields from
tablenameId.
Here is the problem:
I'm not sure how to fetch data using the
tablename/
tablenameId paradigm. Since my mapping file only contains a composite-id with > 100 fields, how can I do something like this in Spring:
Code:
this.hibernateTemplate.find("from Cdpcus customer where customer.cusno IN ('401', '403')");
Can't do this right?
Cdpcus.java only has 1 atribute: a CdpcusId...
CdpcusId.java has the cusno attribute - but there is no mapping for
CdpcusId.java.
Must I fetch only with a fully populated tablenameId like this:
Code:
this.hibernateTemplate.find("from Cdpcus customer where customer.id = a_tablenameId");
That leads to another dead-end question: how do I get a populated tablenameId object.
Thanks for your feedback.