non-identifying optional relationships (hibernate plugin)

Vishal Shanbhag <[email protected]> Tue, 8 Feb 2005 12:41:34 -0800 (PST)
Newsgroups gmane.comp.java.ejb.middlegen.user
Message-ID <[email protected]>
Hello,

We have a "non-identifying optional relationship"
between 2 entities A & B which has cardinality "one to
many" from A to B. Middlegen correctly identifies the
relationship but when it generates the hibernate
mapping file for B, it sets the "non-null" attribute
to "true" in the many-to-one association field it puts
in B.

Since A-B is an "optional" relationship, we can have
rows in the table B that have the foreign key from
table A set to null. But when hibernate tries to save
B, it throws an exception saying "non-null attribute
is null". Hence hibernate is enforcing a constraint
which doesnt really exist in the underlying database.

My questions are :

Is it possible to configure the "non-null" attribute
of a relationship through middlegen?

Is there a way to solve this problem without having to
manually edit the hibernate mapping files before
generation the java files?

Best
Vishal


		
__________________________________ 
Do you Yahoo!? 
The all-new My Yahoo! - What will yours do?
http://my.yahoo.com 


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click