File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Doubt on TableGenerator Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Doubt on TableGenerator" Watch "Doubt on TableGenerator" New topic

Doubt on TableGenerator

Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9999


In the following statement,

create table GENERATOR_TABLE (

VALUE_COLUMN long not null


I"m not able to interpret this. What could be the primary key and what could be the value column? Please help!

SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
Christophe Verré

Joined: Nov 24, 2005
Posts: 14688

I guess this is table used for generation primary keys ? When you define a primary key generated by a table (@GeneratedValue(strategy=TABLE, generator="customerGen")), you will define a TableGenerator (@TableGenerator) which will create, behind the scene, a table holding primary keys. Look at the the following TableGenerator annotation:

The pkColumnName holds the name of the primary key column of the generator table (we need a pk in this table too). The valueColumnName holds the last generated value.

[My Blog]
All roads lead to JavaRanch
I agree. Here's the link:
subject: Doubt on TableGenerator
It's not a secret anymore!