permaculture playing cards*
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 Android Security Essentials Live Lessons this week in the Android 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: 394
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: 394
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?


 
wood burning stoves
 
subject: HSQL db for JPA: auto incremented for a regular column
 
Similar Threads
how to set auto increment field value ?
Regarding Jtable row Deletion
Leaving any property unmapped to a column in Hibernate using annotation
Something is wrong in my SQL update
InvalidMappingException