Hi!

I have a bean which is defined with an unknown primary key. 
The bean has a jbosscmp-jdbc.xml file associated where the pk is specified.

It all works fine in the hypersonic db and jboss 3.2.5, but when bringing it to our 
real db environment, db2 7.2, I get the following problems:



At deployment: 
create table error:

10:07:19,053 ERROR [EntityContainer] Starting failed 
jboss.j2ee:jndiName=local/TestT,service=EJB org.jboss.deployment.DeploymentException: 
Error while creating table IMAGE; - nest
ed throwable: (COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver][DB2/LINUX] SQL0104
N  An unexpected token "," was found following "ER NOT NULL IDENTITY".  Expected t
okens may include:  "<references_spec>".  SQLSTATE=42601
)
        at org.jboss.ejb.plugins.cmp.jdbc.JDBCStartCommand.createTable(JDBCStartCo
...



This is not a show stopper problem. I could create the tables myself, and so I did...


At runtime: (after I created the tables myself...)  
primary key generation error


-----------------------------------------------------------------------------------
09:58:55,850 ERROR [ImageCollection] Could not create entity
COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver][DB2/LINUX] SQL0798N  A value cann
ot be specified for column "ID" which is defined as GENERATED ALWAYS.  SQLSTATE=42
8C9

        at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.throw_SQLException(SQLExcept
ionGenerator.java:267)
        at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.throw_SQLException(SQLExcept
ionGenerator.java:209)
        at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.check_return_code(SQLExcepti
onGenerator.java:455)
        at COM.ibm.db2.jdbc.app.DB2PreparedStatement.execute2(DB2PreparedStatement
----------------------------------------------------------------------------



This I get when I rely on the default entity command. (none specified)
What <entity-command> should be used for db2? (I have seen posts on one called 
DB2IdentityValLocalCreateCommand which seem to be the right one, but when adding an 
entity command myself for this class, the classfile is not found...) 

For the working hypersonic sql, I use <entity-command name="hsqldb-fetch-key"/>


This is my pk definition in the jboss file

          <unknown-pk>
             <unknown-pk-class>java.lang.Integer</unknown-pk-class>
             <column-name>ID</column-name>
             <jdbc-type>INTEGER</jdbc-type>
             <sql-type>INTEGER</sql-type>
             <auto-increment/>
          </unknown-pk>

When I created the tables myself, I made an ID column as follows 
ID INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY ( START WITH +1 , INCREMENT BY +1 , 
CACHE 20 )


Any clues on this?


View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3852877#3852877

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3852877


-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to