Thanks a lot!

I've switched the beans from the normal use to the auto-gen key and
this last bean was basically overlooked in the process.

It worked like a charm from the first time. Thanks a lot for your
help. You saved me quite a few brain-cells. :)

AL> First, you should have

AL> public void ejbPostCreate(ALocal a ) {

AL> do you have it?

AL> alex

AL> Wednesday, May 28, 2003, 1:45:32 PM, costin costin wrote:

c>>   Hello!

c>>   I am having difficulties with a CMR relation on one of my web-apps.

c>>   I am using JBoss 3.2.0 and MySql 4.0.12 on Linux 2.4.18.

c>>   I have the following diagram:

c>>   +--------+
c>>   | A bean |
c>>   +--------+
c>>       A 1
c>>       |
c>>       V *
c>>   +------+
c>>   |B bean|
c>>   +------+

c>>   The problem appears when creating the B bean. Using middlegen and
c>>   xdoclet I have the following create method:

c>>   ----

c>> public java.lang.Integer ejbCreate(ALocal a ) throws javax.ejb.CreateException {
c>>       // Set CMP fields
c>>       // EJB 2.0 spec says return null for CMP ejbCreate methods.
c>>       return null;
c>>    }

c>>    public void ejbPostCreate( java.lang.Integer id, , ALocal a ) throws 
javax.ejb.CreateException {
c>>       // Set CMR fields
c>>       setA(a);
c>>    }
c>>    ----

c>>     So, basically I need a A reference before I can make some B beans.

c>>     Typically, the A beans gets created first and then I have to add
c>>     some B beans to the mix

c>>     Even though , I am finding a reference to the
c>>     ALocal (I am logging it and test it to be != null), after I make the call to 
the create() method
c>>     the database field (I am using ForeingKeys) gets only NULL.

c>> ----
c>>                try
c>>                 {
c>>                         referenceA = getABean();
                        
c>>                         if (referenceA== null)
c>>                                 logger.debug("*** reference A == null");
c>>                         else
c>>                                 logger.debug("*** reference A NOT null");
                                
c>>                         facade.create(
c>>                                         referenceA
c>>                         );

c>>                         logger.debug("Done writing into the database");

c>>                 }
c>>                 catch (Exception e)
c>>                 {
c>>                         logger.error("I have an exception");
c>>                 }

c>> ----
    
c>>     Can anyone give me a clue here about what is going wrong...



AL> -------------------------------------------------------
AL> This SF.net email is sponsored by: ObjectStore.
AL> If flattening out C++ or Java code to make your application fit in a
AL> relational database is painful, don't do it! Check out ObjectStore.
AL> Now part of Progress Software. http://www.objectstore.net/sourceforge
AL> _______________________________________________
AL> JBoss-user mailing list
AL> [EMAIL PROTECTED]
AL> https://lists.sourceforge.net/lists/listinfo/jboss-user


-- 
 costin                            mailto:[EMAIL PROTECTED]



-------------------------------------------------------
This SF.net email is sponsored by: ObjectStore.
If flattening out C++ or Java code to make your application fit in a
relational database is painful, don't do it! Check out ObjectStore.
Now part of Progress Software. http://www.objectstore.net/sourceforge
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to