Physical table name - abstract table name mapping in CMP Bean

Hello,

I am using a EJB 2.x bean deployed on a SJSAS 9 server. EJB has problem associating the EJB to the actual table

Details are as follows:

EJB name: AccountCMP

Actual tablename : account

Error

ejb store called

IM: postInvokeentity3.AccountBean145996470_ConcreteImpl@d6be89

EJB5071: Some remote or transactional roll back exception occurred

com.sun.jdo.api.persistence.support.JDODataStoreException: JDO76400: Got a JDBC SQLException while executing the SQL statement:

insert into "ACCOUNTCMP"("DESCRIPTION", "ACCOUNTNAME", "BALANCE", "ACCID") values ( ?, ?, ?, ?).

Please examine the SQLException for more information.

NestedException: java.sql.SQLException: ORA-00942: table or view does not exist

FailedObjectArray: [entity3.AccountBean145996470_JDOState@5332ca]

....

__

Please note that the insert statement has the ejb-name (I think so, as my CMP EJB is called ACCOUNTCMP) instead of the actual tablename (account).

I do have the account.dbschema file and sun-cmp-mappings.xml in the NB 5.5 project, but the mappings.xml file is not included in the jar by NB. Is that expected, or an problem.

sun-cmp-mappings.xml

<sun-cmp-mappings>

<sun-cmp-mapping>

<schema>account</schema>

<entity-mapping>

<ejb-name>AccountCMP</ejb-name>

<table-name>account</table-name>

<cmp-field-mapping>

ejb-jar.xml

<enterprise-beans>

<entity>

<ejb-name>AccountCMP</ejb-name>

<local-home>entity3.AccountLocalHome</local-home>

<local>entity3.AccountLocal</local>

<ejb-class>entity3.AccountBean</ejb-class>

<persistence-type>Container</persistence-type>

<prim-key-class>entity3.AccountPK</prim-key-class>

<reentrant>false</reentrant>

<cmp-version>2.x</cmp-version>

<abstract-schema-name>account</abstract-schema-name>

Thank you for your help.

[2195 byte] By [Jithesh_Gangadharana] at [2007-11-27 5:25:28]
# 1

Hello,

I found out the issue. sun-cmp-mappings.xml file is mandatory, and dont know why, netbeans excludes this file from the jar. I had to edit project.properties file to negate this exclusion.

Another problem was that my table did not have a primary key (and hence by schema file did not have it also). CMP bean code generator did not like this.

Once I fixed these two problems, my CMP started working fine.

Thank you all

Jithesh_Gangadharana at 2007-7-12 14:45:35 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...