No, we are using the composite-id element in the maps:
Code:
<composite-id>
<key-property name="ruleID" column="rule_id" type="java.lang.Integer">
<meta attribute="use-in-equals">true</meta>
</key-property>
<key-property name="statatementID" column="statement_id" type="java.lang.Integer">
<meta attribute="use-in-equals">true</meta>
</key-property>
</composite-id>
So, I haven’t tried the using a custom key class (named
xxxxKey.java). The map snipped form our
statement.hbm.xml file and to get out the id’s from the composite keys using the criteria, we are using something like this code:
Code:
Criteria crit = sess.createCriteria(Statement.class);
List list = crit.list();
Statement myStatement = null;
Iterator elements = list.iterator();
while(elements.hasNext()){
myStatement = (Statement) elements.next();
System.out.println("Id: " + myStatement.get StatementID());
}
My best suggestion is for you to try to use this approach. Then your code would (maybe) look something like this:
Code:
Criteria crit = sess.createCriteria(Tapplicationproject.class);
List list = crit.list();
Tapplicationproject myObject = null;
Iterator elements = list.iterator();
while(elements.hasNext()){
myObject = (Tapplicationproject) elements.next();
System.out.println("Id: " + myObject.getTapplicationprojectKey().getApplicationId())
}