Joined: Wed Mar 02, 2005 11:05 am Posts: 5
|
Good evening to everybody !
Maybe someone of you cam help me. The problem I have should be quite common, but I haven't been able to figure out a smart solution.
I have a class Article with a String property eanCode:
class Article {
//...
String eanCode;
}
eanCode cam be null - if it is not it must be unique. How can I map this in an efficient way with Hibernate.
I already tried to use an extra entity class EANCode and a manyToOne relation from Article to EANCode. This seems to be a bit heavyweight for this simple purpose. Moreover I was not able to make Hibernate delete the EANCode automatically when I set the eanCode property in Article to null. (Even with a back-ptr from EANCode to Article - constrained one-to-one mapping and cascade=all-delete-orphan on the other side)
Did anybody have the same problem and what could be an efficient solution. Thanks in advance for any help...
_________________ MrLongleg
------------------------------------------
Life is too short to drink bad wine ;-)
|
|