GeeCON Prague 2014*
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


JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Doubt on TableGenerator" Watch "Doubt on TableGenerator" New topic
Author

Doubt on TableGenerator

Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9400
    
    2

Guys,

In the following statement,

create table GENERATOR_TABLE (

PRIMARY_KEY_COLUMN VARCHAR not null,
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é
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

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: http://aspose.com/file-tools
 
subject: Doubt on TableGenerator