aspose file tools*
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
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: 471
    
    4
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: 471
    
    4
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?


 
It is sorta covered in the JavaRanch Style Guide.
 
subject: HSQL db for JPA: auto incremented for a regular column