• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

JBoss CMP: "auto-increment" not recognised

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Veemal,
As our naming policy disallows initials for a last name, I'll have to ask you to modify your display name accordingly.
Thanks.
 
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm moving this to the JBoss forum.
 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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).

 
Crusading Chameleon likes the size of this ad:
Garden Master Course kickstarter
https://coderanch.com/t/754577/Garden-Master-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic