I have created a simple Bean Managed Persistence
EJB and got it to work with PointBase4 and JBoss3.0.3
I am now try to convert the bean to use Container mananged persistence but I am having problems running the
test program.
The EJB is a simple "Quote of the day" app that reads a quote from the database.
The table is defined as follows in Pointbase
**************************************************
CREATE TABLE "QOTD"."QOTD" (
"ID" INTEGER IDENTITY NOT NULL,
"CREATE_DATE" TIMESTAMP,
"MODIFY_DATE" TIMESTAMP,
"QUOTE_TEXT" VARCHAR(1000),
"DISPLAY_FLAG" BOOLEAN );
**************************************************
The Entity bean is defined in ejb-jar.xml as follows..
**************************************************
<ejb-jar>
<enterprise-beans>
...
<entity>
<ejb-name>quotecmp</ejb-name>
<home>qotd.QuoteCMPHome</home>
<remote>qotd.QuoteCMP</remote>
<ejb-class>qotd.QuoteCMPBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>qotd.QuotePK</prim-key-class>
<reentrant>false</reentrant>
<cmp-version>2.x</cmp-version>
<abstract-schema-name>QuoteCMPBean</abstract-schema-name>
<cmp-field><field-name>quote</field-name></cmp-field>
<cmp-field><field-name>display</field-name></cmp-field>
<cmp-field><field-name>lastMod</field-name></cmp-field>
<cmp-field><field-name>created</field-name></cmp-field>
</entity>
</enterprise-beans>
...
</ejb-jar>
**************************************************
The content of the jbosscmp-jdbc.xml packaged in the jar is :
**************************************************
<?xml version="1.0" encoding="UTF-8"?>
<jbosscmp-jdbc>
<defaults>
<debug>true</debug>
<create-table>false</create-table>
<remove-table>false</remove-table>
<unknown-pk>
<unknown-pk-class>java.lang.Integer</unknown-pk-class>
<field-name>id</field-name>
<column-name>id</column-name>
<jdbc-type>INTEGER</jdbc-type>
<auto-increment/>
</unknown-pk>
<read-only>false</read-only>
<time-out>0</time-out>
<select-for-update>false</select-for-update>
<pk-constraint>true</pk-constraint>
<relation-mapping-style>foreign-key</relation-mapping-style>
<read-ahead>
<strategy>on-load</strategy>
<page-size>500</page-size>
<eager-load-group>group name</eager-load-group>
</read-ahead>
</defaults>
<enterprise-beans>
<entity>
<ejb-name>quotecmp</ejb-name>
<table-name>qotd</table-name>
<cmp-field>
<field-name>created</field-name>
<column-name>create_date</column-name>
</cmp-field>
<cmp-field>
<field-name>lastMod</field-name>
<column-name>modify_date</column-name>
</cmp-field>
<cmp-field>
<field-name>quote</field-name>
<column-name>quote_text</column-name>
</cmp-field>
<cmp-field>
<field-name>display</field-name>
<column-name>display_flag</column-name>
</cmp-field>
</entity>
</enterprise-beans>
</jbosscmp-jdbc>
**************************************************
I pieced this file together from various snippets of info on the net so not sure if it is correct!
When I run a simple test to create a new bean I get the following error:
**************************************************
javax.ejb.FinderException: Find failed: java.sql.SQLException: Expected to find "FROM" instead found
"QOTD" at position 13.
at org.jboss.ejb.plugins.cmp.jdbc.JDBCAbstractQueryCommand.execute(JDBCAbstractQueryCommand.
java:148)
at org.jboss.ejb.plugins.cmp.jdbc.JDBCFindEntityCommand.execute(JDBCFindEntityCommand.java:4
4)
at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.findEntity(JDBCStoreManager.java:541)
at org.jboss.ejb.plugins.CMPPersistenceManager.findEntity(CMPPersistenceManager.java:336)
at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.findEntity(CachedConnect
ionInterceptor.java:301)...
**************************************************
TIA for your help!
Ayub.