From: costin <gic...@ed...> - 2003-05-28 10:44:13
|
Hello! I am having difficulties with a CMR relation on one of my web-apps. I am using JBoss 3.2.0 and MySql 4.0.12 on Linux 2.4.18. I have the following diagram: +--------+ | A bean | +--------+ A 1 | V * +------+ |B bean| +------+ The problem appears when creating the B bean. Using middlegen and xdoclet I have the following create method: ---- public java.lang.Integer ejbCreate(ALocal a ) throws javax.ejb.CreateException { // Set CMP fields // EJB 2.0 spec says return null for CMP ejbCreate methods. return null; } public void ejbPostCreate( java.lang.Integer id, , ALocal a ) throws javax.ejb.CreateException { // Set CMR fields setA(a); } ---- So, basically I need a A reference before I can make some B beans. Typically, the A beans gets created first and then I have to add some B beans to the mix Even though , I am finding a reference to the ALocal (I am logging it and test it to be != null), after I make the call to the create() method the database field (I am using ForeingKeys) gets only NULL. ---- try { referenceA = getABean(); if (referenceA== null) logger.debug("*** reference A == null"); else logger.debug("*** reference A NOT null"); facade.create( referenceA ); logger.debug("Done writing into the database"); } catch (Exception e) { logger.error("I have an exception"); } ---- Can anyone give me a clue here about what is going wrong... -- costin |