Discussion:
[Middlegen-user] RE: [Xdoclet-user] CMR with JBoss and FK NOT NULL constraints in database
Aslak Hellesøy
2002-10-22 10:09:04 UTC
Permalink
Thank you Bernhard for this information.

I believe this is relevant to Middlegen, which I believe you have already
tried. More specifically to
http://boss.bekk.no/boss/middlegen/plugins/cmp20.html#fkcmp

Do you know if there is a bug report on this FK issue that I could watch?

Cheers,
Aslak
-----Original Message-----
Meyer-Willner, Bernhard
Sent: 22. oktober 2002 09:37
To: Xdoclet-User (E-Mail)
Subject: [Xdoclet-user] CMR with JBoss and FK NOT NULL constraints in
database
Hi,
I'm a heavy XDoclet and JBoss user and lover, and although this is an
XDoclet mailing list I think this will be of interest to some
people like me
who use XDoclet together with JBoss.
A few days ago I posted some messages regarding the topic of setting CMR
relationships and FK NOT NULL constraints in the corresponding DB tables
(unfortunately I didn't get any replies). Anyways, first I thought XDoclet
was generating crap somehow, but sure enough it wasn't. By doing some
research in the JBoss forums I found it's a bug in JBoss,
JBossCMP - its CMP
engine - to be exact which is supposed to be fixed by version 3.1
(we're are
3.0.3 now). This comes from Dain Sundstrom, chief developer of JBossCMP.
Problem with JBoss is: Right now it's not capable (WebLogic supposedly is)
to defer committing the insert statement for ejbCreate/ejbPostCreate until
the end of ejbPostCreate. This means if you call ejbCreate on an
entity bean
which has relationships with other beans and the FK columns by which these
relationships are mapped are declared NOT NULL in the DB, you get
a NOT NULL
constraint violation from your DB telling you the FK field has to have a
value. Of course, the FK field is only filled after setting the
CMR field in
your entity bean. For JBoss, however, this is too late if done
ejbPostCreate. By this time you will already have received your
CreateException caused by the DB. All this creates a dilemma,
since to make
JBoss happy the CMR field should be set in ejbCreate, of course this is
disallowed, rightfully so, by the EJB spec and JBoss doesn't like this
either.
Well, by now you already know that I like writing novels, but to
make a long
story short: This is a bug in JBoss which will hopefully be fixed
soon. For
now the only workaround is to disable or remove those NOT NULL constraints
in your DB. I guess some DBA's will hate you for that but there's no other
choice.
Another thing in this regard: I saw in the new XDoclet docs that it's
recommended as a best practice to call the setXXXValue() method for a bean
in ejbPostCreate. I think this is a good idea which I would like
to follow.
Unfortunately, JBoss won't allow this at the moment.
Regards
Bernhard
---
Bernhard Meyer-Willner
Insurance - Financial Services
Logica GmbH
Alster City
Osterbekstrasse 90b
22083 Hamburg (Germany)
(+49) 40-27071-405
(+49) 177-425-9036
www.logica.com/de
This e-mail and any attachment is for authorised use by the
intended recipient(s) only. It may contain proprietary material,
confidential information and/or be subject to legal privilege.
It should not be copied, disclosed to, retained or used by, any
other party. If you are not an intended recipient then please
promptly delete this e-mail and any attachment and all copies and
inform the sender. Thank you.
-------------------------------------------------------
This sf.net emial is sponsored by: Influence the future of
Java(TM) technology. Join the Java Community Process(SM) (JCP(SM))
program now. http://ad.doubleclick.net/clk;4699841;7576301;v?
http://www.sun.com/javavote
_______________________________________________
Xdoclet-user mailing list
https://lists.sourceforge.net/lists/listinfo/xdoclet-user
Matthias Flor
2002-11-26 08:08:03 UTC
Permalink
Aslak Hellesøy wrote:
[...]
Post by Aslak Hellesøy
Do you know if there is a bug report on this FK issue that I could watch?
There is a FR for JBoss, assigned to the CMP-engine developer Dain,
still marked as open:

http://sourceforge.net/tracker/?func=detail&atid=376688&aid=558869&group_id=22866

HTH,
Matthias
--
Matthias Flor <***@isb-ag.de>
------------------------------------------------------------------
ISB AG Fon: +49 (0)721/82800-0
Karlstrasse 52-54 Fax: +49 (0)721/82800-82
D-76133 Karlsruhe Web: http://www.isb-ag.de
Loading...