RE: [JBoss-user] [Persistence & CMP/JBoss] - Re: Problem : CMR field cannot be null

2004-02-13 Thread Alexey Loubyansky
Title: [JBoss-user] [Persistence & CMP/JBoss] - Re: Problem : CMR field cannot be null



A field is either a CMP or CMR, not both. CMP fields can be 
mapped to foreign key columns.
 



From: 
[EMAIL PROTECTED] 
[mailto:[EMAIL PROTECTED] On Behalf Of Rod 
MacphersonSent: Friday, February 13, 2004 2:31 AMTo: 
[EMAIL PROTECTED]Subject: RE: [JBoss-user] 
[Persistence & CMP/JBoss] - Re: Problem : CMR field cannot be 
null

  
  It definitely works on 3.2.2 or greater. One caveat is that you cannot 
  use container generated primary keys, perhaps that is the problem you are 
  seeing? You have to supply the primary key "manually". As far as patching 
  jboss.xml you can do that in your ant script after XDoclet has run with a 
  simple substitution. 
   
  Sounds like you have a good solution though. I did not realize you could 
  stipulate that a field was both CMR and CMP. You sure that works? If so that's 
  great.  


RE: [JBoss-user] [Persistence & CMP/JBoss] - Re: Problem : CMR field cannot be null

2004-02-12 Thread Rod Macpherson
It definitely works on 3.2.2 or greater. One caveat is that you cannot use container 
generated primary keys, perhaps that is the problem you are seeing? You have to supply 
the primary key "manually". As far as patching jboss.xml you can do that in your ant 
script after XDoclet has run with a simple substitution. 
 
Sounds like you have a good solution though. I did not realize you could stipulate 
that a field was both CMR and CMP. You sure that works? If so that's great. 

-Original Message- 
From: sesques [mailto:[EMAIL PROTECTED] 
Sent: Thu 2/12/2004 2:40 PM 
To: [EMAIL PROTECTED] 
Cc: 
Subject: [JBoss-user] [Persistence & CMP/JBoss] - Re: Problem : CMR field 
cannot be null



View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3821315#3821315

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3821315

Hi,



Thanks for response but cannot work:



I insert :



  

  foobar

  true

  



in my jboss.xml and I threw the exception:

"Primary key for created instance is null" when I returned from ejbCreate. 
It's because JBOSS wants to gets the primary key just after the ejbCreate method.



Another problem is that I dont know how to generate the container 
configuration with XDoclet. So I have to patch the file jboss.xml each time the file 
is regenerated.



In fact, I saw one solution on other forums: I create CMP fields for foreign 
keys and I initialize them in ejbCreate, then I initialize CMR fields in 
ejbPostCreate. This solution work, even if it is not in the state of the art.








---
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


<>