This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Object Relational Mapping and the fly likes HSQL db for JPA: auto incremented for a regular column Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "HSQL db for JPA: auto incremented for a regular column" Watch "HSQL db for JPA: auto incremented for a regular column" New topic
Author

HSQL db for JPA: auto incremented for a regular column

H Paul
Ranch Hand

Joined: Jul 26, 2011
Posts: 412
    
    3
This is just a regular column that I want to have it auto incremented



After loading data, the NUMBER is always zero.

Am I missing something or doing something wrong or is HSQL db sql syntax incorrect?
James Sutherland
Ranch Hand

Joined: Oct 01, 2007
Posts: 553
Try adding,

@GeneratedValue(IDENTITY)

See,
http://en.wikibooks.org/wiki/Java_Persistence/Identity_and_Sequencing#Sequencing


TopLink : EclipseLink : Book:Java Persistence : Blog:Java Persistence Performance
H Paul
Ranch Hand

Joined: Jul 26, 2011
Posts: 412
    
    3
0. Thanks, James.

1. From
HyperSQL User Guide
HyperSQL Database Engine (HSQLDB) 2.2


2. Below is OK. Nothing unusual.



3. What I want is NOT an ID, rather a regular colum with auto-incremented.
This is OK by point 1. That's if we create using DDL itself.
But below is not OK. Could there be something else?


 
Don't get me started about those stupid light bulbs.
 
subject: HSQL db for JPA: auto incremented for a regular column