Register / Login
this forum made possible by our volunteer staff, including ...
Roel De Nijs
Stephan van Hulst
Object Relational Mapping
Populate an empty object if none is found
posted 9 years ago
I have a many-to-one relation in my mapping file.
In some cases, this many-to-one value does not exist in the joing table.
Is it possible for me to populate this many-to-one object with only the identifier value and the rest empty?
The database does not have foreign keys so there is possible there could exist such a key that does not refer to a value in the many-to-one table.
I could add not-found="ignore", but that would entail that the mapped object gets a null object for the many-to-one relation.
In other words get Hibernate to populate/create object2 inside object1 with only the identifier value in object1.
[ February 07, 2008: Message edited by: Sverre Moe ]
It is sorta covered in the
JavaRanch Style Guide
Boost this thread!
constructor - help needed
Container Managed Relations
Serialization of strings
Hibernate - Mapping foreign keys tables
ManyToMany with extra attribute in JPA