Hi,
I am currently using Hibernate for persistence in DAO objects. My question is : can Hibernate handle associations based on keys instead of a direct reference ?
What I mean is this : normally aProduct.getCustomer() returns an associated customer, but in some cases associations are maintained solely via key objects. In that case, aProduct.getCustomerKey() returns the key object of type CustomerKey that holds the unique ID to a certain customer, and aProduct.setCustomerKey(aCustomerKey) sets it - there are no other getters and setters for customer on a product object.
Sofar I have experimented with <idbag>, components as composite IDs, and PropertyAccessors but I didnt get it to work. Can it be done ? Can you show me how ?
Kind regards,
sytze.
|