| Author |
JBoss CMP: "auto-increment" not recognised
|
Veemal G.
Greenhorn
Joined: Dec 23, 2003
Posts: 1
|
|
Hi All, I'm using Jboss 3.2.3. I have a table in MSSQL which is having an auto-incrementing field as primary key. Im my jbosscmp-jdbc.xml, I have the following declarations to cater for the auto-increment field: <cmp-field> <field-name>job_no</field-name> <column-name>job_no</column-name> <auto-increment/> </cmp-field> <entity-command name="mssql-fetch-key"/> But then, when I deploy my application, JBoss throws the following exception: 121. Error message: Element type "auto-increment" must be declared . 21:39:36,938 ERROR [XmlFileLoader] XmlFileLoader: File jar:file:/E:/cvs/jboss-3.2.3-src/build/output/jboss-3.2.3/server/default/tmp/deploy/tmp30365ProcessOrder.jar!/META-INF/jbosscmp-jdbc.xml process error. Line: 122. Error message: The content of element type "cmp-field" must match " (field-name,read-only?,read-time-out?,column-name?,not-null?,((jdbc-type,sql-type)|property+)?)". The auto-increment element type is not being recognised, and jboss seems to be complaining wrongly, coz according to the jbosscmp-jdbc_3_2.dtd : <!ELEMENT cmp-field (field-name, read-only?, read-time-out?, column-name?, not-null?, ((jdbc-type, sql-type) | (property+))?, auto-increment?, dbindex?, check-dirty-after-get?, state-factory? )> Does anybody has a clue why this is so? I've searched through the forum and checked out the JBoss pay-for docs, and I seem to be the only one having this issue. Thanks!
|
 |
Lasse Koskela
author
Sheriff
Joined: Jan 23, 2002
Posts: 11962
|
|
Veemal, As our naming policy disallows initials for a last name, I'll have to ask you to modify your display name accordingly. Thanks.
|
Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
|
 |
Jim Yingst
Wanderer
Sheriff
Joined: Jan 30, 2000
Posts: 18670
|
|
|
I'm moving this to the JBoss forum.
|
"I'm not back." - Bill Harding, Twister
|
 |
Chad Dalton
Greenhorn
Joined: Feb 19, 2003
Posts: 20
|
|
anyone? I'm getting simliar errors, java.sql.SQLException: General error, message from server: "Column 'id' cannot be null" id is auto_increment and my primary key. thanks, --chad
|
 |
Pascal Sesques
Greenhorn
Joined: Feb 05, 2004
Posts: 1
|
|
You have to be sure that your jbosscmp-jdbc.xml file reference the correct DTD: <!DOCTYPE jbosscmp-jdbc PUBLIC "-//JBoss//DTD JBOSSCMP-JDBC 3.2//EN" "http://www.jboss.org/j2ee/dtd/jbosscmp-jdbc_3_2.dtd"> I had the same problem because the DTD was 3.0. But now even if I can add the auto-increment element, I have a JDBC error because JBOSS wants to insert a primary key value. Unfortunatly, I think that JBOSS is not friend with primary keys. Is anybody have the solution ? Thanks
|
 |
Leandro Melo
Ranch Hand
Joined: Mar 27, 2004
Posts: 401
|
|
I'm having this problem too, getting the ERROR [STDERR] javax.ejb.CreateException: Primary key for created instance is null. Can anyone post a working jbosscmp-jdbc.xml so i can take a look?
|
Leandro Melo <br />SCJP 1.4, SCWCD 1.4<br /><a href="http://www.pazbrasil.org/" target="_blank" rel="nofollow">http://www.pazbrasil.org/</a>
|
 |
Leandro Melo
Ranch Hand
Joined: Mar 27, 2004
Posts: 401
|
|
Solved it, now i believe that JBoss works for auto-increments! I any one goes through this problem, just go with the following xdoclets (and make sure dtd is 3.2).
|
 |
 |
|
|
subject: JBoss CMP: "auto-increment" not recognised
|
|
|