• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubt on TableGenerator

 
Joe Harry
Ranch Hand
Posts: 10124
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic