First, you should have

public void ejbPostCreate(ALocal a ) {

do you have it?

alex

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...



-------------------------------------------------------
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