Mike, below is the top of FactoryBean.java. the first EJB created in the chain.
------------------------------------------- import javax.ejb.*; import org.ejbutils.uid.*; import org.ejbutils.context.*; public abstract class FactoryBean implements EntityBean { EntityContext entityContext; public java.lang.String ejbCreate(java.lang.String name) throws CreateException { setName(name); String objectId; try { objectId = UIDDispenser.getDispenser().getNextId(); } catch (UIDDispenserException e) { throw new EJBException(e.toString()); } this.setId(objectId); return objectId; } public void ejbPostCreate(java.lang.String name) throws CreateException { } ... ------------------------------------------- and here is the start of ProcessBean.java the second created. It has a cmr field pointing to the primary key of factory. ------------------------------------------- import java.util.*; import javax.rmi.*; import javax.ejb.*; import javax.naming.*; import org.ejbutils.uid.*; import org.ejbutils.context.*; public abstract class ProcessBean implements EntityBean { EntityContext entityContext; public String ejbCreate(String factory, String name) throws CreateException { setName(name); String objectId; try { objectId = UIDDispenser.getDispenser().getNextId(); } catch (UIDDispenserException e) { throw new EJBException(e.toString()); } setId(objectId); return objectId; } public void ejbPostCreate(String factory, String name) throws CreateException { try { Context ctx = new InitialContext(); FactoryLocalHome flhome = (FactoryLocalHome)ctx.lookup("java:comp/env/ejb/Factory"); FactoryLocal fl = flhome.findByName(factory); this.setFactory(fl); } catch (NamingException e) { throw new EJBException(e.toString()); } catch (FinderException e) { throw new CreateException(e.toString()); } } ... ------------------------------------------- Did not declare the cmr fields in the ejb-jar.xml file, nor the jboss.xml file. All the ejb creates use the UIDispenser from Emmanuel Sciara (many thanks, and everyone that contibuted to the solution). The process bean sets the cmr field pointing to its factory that is looked up by name, in the ejbPostCreate method. Many thanks Daniel -----Original Message----- From: Mike Dougherty [mailto:[EMAIL PROTECTED]] Sent: sexta-feira, 19 de Abril de 2002 21:28 To: Daniel Santos Cc: [EMAIL PROTECTED] Subject: Re: [JBoss-user] CMP 2.0 - CMR fields are NULL Daniel, I'm not sure I completely understand the situation. Maybe if you sent some Java code snippets I could take a stab at it. Like just the "ejbCreate" and "ejbPostCreate" methods for "Variable" or "Factory" which ever one is calling the setter method. /mike On Fri, 2002-04-19 at 08:54, Daniel Santos wrote: > hello all ! > > I'm deploying a hierarchy of entity beans with relations : > > FACTORY <- PROCESS <- COMPONENT <- VARIABLE > > I call creates from a servlet to create the hierarquy from FACTORY to > VARIABLE. > > The CMR fields are set in each ejbPostCreate methods. > > PROCESS sets FACTORY, COMPONENT sets process, so on... up to VARIABLE > > after calling the servlet I notice that the CMR fields in the db are NULL. > > below is the SQL generated. Where are the UPDATES to set the CMR fields ? > > environment : > Jboss-3.0.0beta > jdk 1.3.1 > w2k > mysql-max 3.23.49 with ISAM tables. I know they are not transactional. I > just need the SELECT FOR UPDATE syntax to work > jdbc driver : mm.mysql-2.0.8-bin.jar > > Many thanks. > Daniel Santos > > -------------------------------------------------------------------------- -- > --------------------- > > 020419 16:36:18 2 Connect root@localhost on > 2 Init DB history > 2 Query SHOW VARIABLES > 2 Query SET autocommit=0 > 2 Query show tables FROM history like 'FACTORY' > 2 Query rollback > 020419 16:36:19 2 Query CREATE TABLE FACTORY (id VARCHAR(255) > BINARY NOT NULL, name VARCHAR(255) BINARY, CONSTRAINT pk_FACTORY PRIMARY KEY > (id)) > 2 Query commit > 2 Query rollback > 020419 16:36:21 2 Query show tables FROM history like 'EVENT' > 2 Query rollback > 2 Query CREATE TABLE EVENT (id VARCHAR(255) BINARY NOT >NULL, > CONSTRAINT pk_EVENT PRIMARY KEY (id)) > 2 Query commit > 2 Query rollback > 020419 16:36:22 2 Query show tables FROM history like > 'COMPONENT' > 2 Query rollback > 2 Query CREATE TABLE COMPONENT (id VARCHAR(255) BINARY NOT > NULL, name VARCHAR(255) BINARY, process VARCHAR(255) BINARY, CONSTRAINT > pk_COMPONENT PRIMARY KEY (id)) > 2 Query commit > 2 Query rollback > 020419 16:36:24 2 Query show tables FROM history like > 'VARIABLE' > 2 Query rollback > 2 Query CREATE TABLE VARIABLE (id VARCHAR(255) BINARY NOT > NULL, name VARCHAR(255) BINARY, component VARCHAR(255) BINARY, CONSTRAINT > pk_VARIABLE PRIMARY KEY (id)) > 2 Query commit > 2 Query rollback > 020419 16:36:26 2 Query show tables FROM history like 'SAMPLE' > 2 Query rollback > 2 Query CREATE TABLE SAMPLE (id VARCHAR(255) BINARY NOT NULL, > value VARCHAR(255) BINARY, variable VARCHAR(255) BINARY, CONSTRAINT > pk_SAMPLE PRIMARY KEY (id)) > 2 Query commit > 2 Query rollback > 2 Query show tables FROM history like 'PROCESS' > 2 Query rollback > 2 Query CREATE TABLE PROCESS (id VARCHAR(255) BINARY NOT NULL, > name VARCHAR(255) BINARY, factory VARCHAR(255) BINARY, CONSTRAINT pk_PROCESS > PRIMARY KEY (id)) > 2 Query commit > 2 Query rollback > 020419 16:37:18 2 Query SET autocommit=0 > 2 Query SELECT VALUE FROM HIGH_KEY WHERE NAME = >'gruposumol' > FOR UPDATE > 2 Query INSERT INTO HIGH_KEY (VALUE, NAME) VALUES > ('8080808080808080808080808080','gruposumol') > 2 Query UPDATE HIGH_KEY SET VALUE = > '8180808080808080808080808080' WHERE NAME = 'gruposumol' > 2 Query SET autocommit=0 > 2 Query rollback > 020419 16:37:20 2 Quit > 3 Connect root@localhost on > 3 Init DB history > 3 Query SHOW VARIABLES > 3 Query SET autocommit=0 > 3 Query SELECT COUNT(*) FROM FACTORY WHERE > id='80808080808080808080808080808080gruposumol' > 3 Query INSERT INTO FACTORY (id, name) VALUES > ('80808080808080808080808080808080gruposumol', 'factory') > 020419 16:37:21 3 Query commit > 3 Query rollback > 3 Query SELECT COUNT(*) FROM PROCESS WHERE > id='80808080808080808080808080808180gruposumol' > 3 Query INSERT INTO PROCESS (id, name, factory) VALUES > ('80808080808080808080808080808180gruposumol', 'process', null) > 3 Query SELECT t1_f.id FROM FACTORY t1_f WHERE t1_f.name = > 'factory' > 3 Query SELECT name FROM FACTORY WHERE > (id='80808080808080808080808080808080gruposumol') > 3 Query SELECT id FROM PROCESS WHERE > (factory='80808080808080808080808080808080gruposumol') > 3 Query commit > 3 Query rollback > 3 Query SELECT COUNT(*) FROM COMPONENT WHERE > id='80808080808080808080808080808280gruposumol' > 3 Query INSERT INTO COMPONENT (id, name, process) VALUES > ('80808080808080808080808080808280gruposumol', 'component', null) > 3 Query SELECT t1_p.id FROM PROCESS t1_p WHERE t1_p.name = > 'process' > 3 Query SELECT name, factory FROM PROCESS WHERE > (id='80808080808080808080808080808180gruposumol') > 3 Query SELECT id FROM COMPONENT WHERE > (process='80808080808080808080808080808180gruposumol') > 3 Query commit > 3 Query rollback > 3 Query SELECT COUNT(*) FROM VARIABLE WHERE > id='80808080808080808080808080808380gruposumol' > 3 Query INSERT INTO VARIABLE (id, name, component) VALUES > ('80808080808080808080808080808380gruposumol', 'variable', null) > 3 Query SELECT t1_c.id FROM COMPONENT t1_c WHERE t1_c.name >= > 'component' > 3 Query SELECT name, process FROM COMPONENT WHERE > (id='80808080808080808080808080808280gruposumol') > 3 Query SELECT id FROM VARIABLE WHERE > (component='80808080808080808080808080808280gruposumol') > 3 Query commit > 3 Query rollback > > > _______________________________________________ > JBoss-user mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/jboss-user > _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user