users@glassfish.java.net

Autogenerated findByPrimaryKey getting table name wrong

From: <glassfish_at_javadesktop.org>
Date: Fri, 03 Apr 2009 10:45:15 PDT

Initially a quick question to see if anyone recognizes this. I am about to restart the app.server in debug mode to see if I can get further details ...

I have an EJB2 CMP with a SSB facade, being invoked from a remote client. All in GF2.1.

The SSB invokes the CMP's findByPrimaryKey(String) method and the server dies horribly because the select statement uses the CMP bean's name instead of the tablename specified in both the sun-cmp-mappings.xml file and APP_xxx.dbschema file:

javax.ejb.TransactionRolledbackLocalException: Exception thrown from bean; nested exception is:
javax.ejb.TransactionRolledbackLocalException: Exception thrown from bean; nested exception is:
com.sun.jdo.api.persistence.support.JDODataStore
Exception: JDO76400: Got a JDBC SQLException while executing the SQL statement:
SQL statement<select t0."ID", t0."NUMBER" from "COMMITTABLEBEAN" t0 where t0."ID" = CAST (? AS VARCHAR(32672))> with input values:java.lang.String:ID:6405166886627479497.
Please examine the SQLException for more information.
NestedException: java.sql.SQLSyntaxErrorException: Table/View 'COMMITTABLEBEAN' does not exist.

Damn right it doesn't - the table is called COMMIT_TABLE :-)

More details to follow unless someone chimes in with an answer :-)

TIA, m.
[Message sent by forum member 'matterbury' (matterbury)]

http://forums.java.net/jive/thread.jspa?messageID=340513