This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread 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


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: 464
    
    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: 464
    
    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?


 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HSQL db for JPA: auto incremented for a regular column