Solved the problem myself by doing what I described in my first mail.
Introduced one setValueCMP and one setValueCMR method which only set CMP
fields or CMR fields rsp. setValueCMP is called in ejbCreate, setValueCMR in
ejbPostCreate. I saw on the new XDoclet website in the "best practices"
section that it is recommended to apply the setXXXValue method in
ejbPostCreate. This was not applicable in my case due to my NOT NULL
constraints in the database. 

I still believe this to be a common problem when using an existing (legacy)
database. What do y'all think about this?

Another thing: Does anybody know how I insert a blank line in one of the
XDoclet templates.

Bernhard

-----Urspr�ngliche Nachricht-----
Von: Meyer-Willner, Bernhard [mailto:[EMAIL PROTECTED]]
Gesendet: Dienstag, 15. Oktober 2002 10:05
An: '[EMAIL PROTECTED]'
Betreff: [Xdoclet-user] Problem with setting CMR fields in setValue()


Hi again,

has really never anybody had this problem before. I assume it's not too
uncommon to have NOT NULL columns in databases, so I would think not to
(hopefully) be the only one having these kinds of problems.

I'd appreciate any input!

Thanks.

Bernhard

-----Urspr�ngliche Nachricht-----
Von: Meyer-Willner, Bernhard [mailto:[EMAIL PROTECTED]]
Gesendet: Montag, 14. Oktober 2002 12:22
An: Xdoclet-User (E-Mail)
Betreff: [Xdoclet-user] Problem with setting CMR fields in setValue()


Hi,

I'm using CMP 2.0 entity beans with CMR's and XDoclet 1.2.0's value object
feature. I'm having a problem with XDoclet's implementation of the
setValue(blaVO) method in the generated CMP class. setValue() tries to set
a) all CMP fields and b) all CMR fields.

Trying to use setValue() in ejbCreate gets me into trouble because of this
behavior. I know that CMR fields need to be set in ejbPostCreate instead of
ejbCreate. However, I can't simply set only the primary key field in
ejbCreate and set the rest of the CMP fields together with the CMR fields in
ejbPostCreate since I have certain NOT NULL columns in the database.

Calling setValue() in ejbCreate gets me into trouble with the appserver
(JBoss) because setValue() tries to set CMR fields in ejbCreate then.
Calling setValue() in ejbPostCreate also gets me into trouble because the
database complains about NOT NULL constraint violations.

Has anybody else ever had these kinds of problems or is there another way to
solve this. As I see it right now, I need to alter the entitycmp-template
and split setValue up in two methods, one for setting CMP fields, and one
for setting CMR fields.

Cheers
Bernhard


 

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 email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user

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 email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user

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 email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user

Reply via email to