I seem to have found the root issue - seems to have nothing to do whatsoever with the VO. I got around the compile problem by letting XDoclet generate a CustomerPK file since it kept insisting on using that in findByPrimaryKey. Now it compiles and deploys fine.
In my simple test I am using the CustomerBean to create a Customer record (as illustrated below). The database record is successfully created, but then the bean's pk is not being set. So any subsequent attempts to access the bean result in an exception. I suspect that this may be caused by misconfigured <entity-command> or <unknown-pk>. Here's what I get in the log: 2003-09-24 19:27:06,983 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.mysql.JDBCMySQLCreateCommand.Customer] Executing SQL: INSERT INTO Customer (customerID, status, email, passwordMD5, regDate) VALUES (?, ?, ?, ?, ?) 2003-09-24 19:27:07,018 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.mysql.JDBCMySQLCreateCommand.Customer] Rows affe cted = 1 2003-09-24 19:27:07,019 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.mysql.JDBCMySQLCreateCommand.Customer] Created: pk=null Here's the code fragments: A. Sample client code: ====================== CustomerHome home = (CustomerHome) PortableRemoteObject.narrow ( cx.lookup ("java:comp/env/ejb/Customer"), CustomerHome.class); Customer customer = home.create (email, password, "norm", new java.sql.Date (System.currentTimeMillis())); B. CustomerBean.java ==================== /* * @ejb.bean name="Customer" * jndi-name="windjunkie/ejb/Customer" * type="CMP" * cmp-version="2.x" * schema="Customer" * * @jboss.persistence * table-name="Customer" * * @ejb.pk * class=java.lang.Object * * @jboss.unknown-pk * class="java.lang.Integer" * column-name="CustomerID" * field-name="CustomerID" * jdbc-type="INTEGER" * sql-type="INTEGER" * auto-increment="true" * readonly="true" * * @jboss.entity-command * name="mysql-get-generated-keys" * */ public abstract class CustomerBean implements EntityBean { public EntityContext mContext; /** * @ejb.persistence * @ejb.interface-method **/ public abstract java.lang.Integer getCustomerID (); /** * @ejb.persistence * @ejb.interface-method **/ public abstract void setCustomerID (java.lang.Integer id); /** * @ejb.persistence * @ejb.interface-method **/ public abstract String getStatus (); ... C. Relevant fragments from ejb-jar.xml and jbosscmp-jdbc.xml: ============================================================= <entity > <ejb-name>Customer</ejb-name> <home>com.windjunkie.interfaces.CustomerHome</home> <remote>com.windjunkie.interfaces.Customer</remote> <local-home>com.windjunkie.interfaces.CustomerLocalHome</local-home> <local>com.windjunkie.interfaces.CustomerLocal</local> <ejb-class>com.windjunkie.beans.entity.CustomerCMP</ejb-class> <persistence-type>Container</persistence-type> <prim-key-class>com.windjunkie.interfaces.CustomerPK</prim-key-class> <reentrant>False</reentrant> <cmp-version>2.x</cmp-version> <abstract-schema-name>Customer</abstract-schema-name> <cmp-field> <field-name>customerID</field-name> </cmp-field> <cmp-field> <field-name>status</field-name> </cmp-field> ...more <cmp-field>'s... </entity> <entity> <ejb-name>Customer</ejb-name> <cmp-field> <field-name>customerID</field-name> </cmp-field> <cmp-field> <field-name>status</field-name> </cmp-field> ...more <cmp-field>'s... <unknown-pk> <unknown-pk-class>java.lang.Integer</unknown-pk-class> <field-name>CustomerID</field-name> <read-only>true</read-only> <column-name>CustomerID</column-name> <jdbc-type>INTEGER</jdbc-type> <sql-type>INTEGER</sql-type> <auto-increment/> </unknown-pk> <entity-command name="mysql-get-generated-keys"> </entity-command> </entity> Now, it seems to me that there is at least 1 problem here: the </prim-key-class> element is not set to java.lang.Object as seems to be right for an unknown key. But maybe there's more?... I am really new to CMP so please help! :-) - Lev --- Tim Olson <[EMAIL PROTECTED]> wrote: > what exactly is the compile error? maybe you could send the > valueobject and > your xdoclet source? > > > -----Original Message----- > > From: Lev Brouk [mailto:[EMAIL PROTECTED] > > Sent: Wednesday, September 24, 2003 8:19 AM > > To: [EMAIL PROTECTED] > > Subject: [Xdoclet-user] JBoss 3.2/Xdoclet 1.2/MySQL autoincrement > pk > > help needed > > > > > > Hi, > > > > Sorry if I am beating the dead horse here, but I wasn't able to > find a > > working example in the last day or so. > > > > I am trying to create an entity ejb using an integer autoincrement > > column of a mysql database, and so far haven't been able to > > successfully do it with XDoclet. > > > > The culpirit of the problem seems to be the ValueObject that > > XDoclet is > > generating for me - it wouldn't compile no matter how I am > declaring > > the PK (Object, Integer, generate or not). > > > > Can someone please post an example of how it can be done? > > > > I am using XDoclet 1.2b3, MySQL 3.23, JBoss 3.2.1 on MacOS X 10.1 > with > > 1.3 jvm > > > > Thanks in advance, > > > > Lev > > > > __________________________________ > > Do you Yahoo!? > > Yahoo! SiteBuilder - Free, easy-to-use web site design software > > http://sitebuilder.yahoo.com > > > > > > ------------------------------------------------------- > > This sf.net email is sponsored by:ThinkGeek > > Welcome to geek heaven. > > http://thinkgeek.com/sf > > _______________________________________________ > > xdoclet-user mailing list > > [EMAIL PROTECTED] > > https://lists.sourceforge.net/lists/listinfo/xdoclet-user > > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > xdoclet-user mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/xdoclet-user __________________________________ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ xdoclet-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/xdoclet-user