JBOSS+MYSQL+PETSTORE-urgent
sahumx Dec 22, 2003 5:35 PMI am trying to run JBOSS+MYSQL+PETSTORE.
I configured everything as given:
Everything starts up well...but when the the application tries to populate the demo data...it errors with this detail:
here are the details and configuration...can you help.....
2003-12-22 23:25:06,984 ERROR [org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.AddressEJB] Could not create entity
java.sql.SQLException: null, message from server: "Column 'AddressEJB_upk' cannot be null"
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1825)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1020)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1109)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2030)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1750)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1596)
at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeUpdate(WrappedPreparedStatement.java:321)
at org.jboss.ejb.plugins.cmp.jdbc.JDBCAbstractCreateCommand.executeInsert(JDBCAbstractCreateCommand.java:334)
at org.jboss.ejb.plugins.cmp.jdbc.JDBCAbstractCreateCommand.performInsert(JDBCAbstractCreateCommand.java:295)
at org.jboss.ejb.plugins.cmp.jdbc.JDBCAbstractCreateCommand.execute(JDBCAbstractCreateCommand.java:144)
at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.createEntity(JDBCStoreManager.java:518)
at org.jboss.ejb.plugins.CMPPersistenceManager.createEntity(CMPPersistenceManager.java:208)
at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.createEntity(CachedConnectionInterceptor.java:269)
at org.jboss.ejb.EntityContainer.createLocalHome(EntityContainer.java:580
I saw that jboss created these default table for the entity beans with a primary key as it own as given below:
Field | Type | Null | Key | Default
---------------+--------------+------+-----+---------
zipCode | varchar(250) | YES | | NULL
state | varchar(250) | YES | | NULL
streetName2 | varchar(250) | YES | | NULL
streetName1 | varchar(250) | YES | | NULL
country | varchar(250) | YES | | NULL
city | varchar(250) | YES | | NULL
AddressEJB_upk | varchar(32) | | PRI |
---------------+--------------+------+-----+---------
Here is my standardjbosscmp-jdbc.xml
java:/DefaultDS
<datasource-mapping>mySQL</datasource-mapping>
<create-table>true</create-table>
<remove-table>false</remove-table>
<read-only>false</read-only>
<read-time-out>300000</read-time-out>
<row-locking>false</row-locking>
<pk-constraint>true</pk-constraint>
<fk-constraint>false</fk-constraint>
<preferred-relation-mapping>foreign-key</preferred-relation-mapping>
<read-ahead>
on-load
<page-size>1000</page-size>
<eager-load-group>*</eager-load-group>
</read-ahead>
<list-cache-max>1000</list-cache-max>
<unknown-pk>
<key-generator-factory>UUIDKeyGeneratorFactory</key-generator-factory>
<unknown-pk-class>java.lang.String</unknown-pk-class>
<jdbc-type>VARCHAR</jdbc-type>
<sql-type>VARCHAR(32)</sql-type>
</unknown-pk>
<entity-command name="default"/>