users@glassfish.java.net

Re: Is TopLink FetchType.LAZY working?

From: <glassfish_at_javadesktop.org>
Date: Thu, 08 May 2008 13:26:05 PDT

Table Generation Strategy works just fine for me in Hibernate.. Did you enable DDL generation in your persistence.xml? eq.
..
<properties>
   <property name="hibernate.hbm2ddl.auto" value="update" />
<properties>
..

In your entity class, do you have the following decleration in the getter method for the key?

@TableGenerator(name = "SOMEENTITY_GENERATOR", table = "KEYGENERATOR", pkColumnName = "PRIMARY_KEY_COLUMN", valueColumnName = "VALUE_COLUMN")
@Id
@Column(name = "SOMEENTITY_ID")
@GeneratedValue(strategy = GenerationType.TABLE, generator = "SOMEENTITY_GENERATOR")

In my case, Hibernate automatically creates the "KEYGENERATOR" table during startup (along with the ROW for SOMEENTITY_GENERATOR initialized to 0).
[Message sent by forum member 'gdaswani' (gdaswani)]

http://forums.java.net/jive/thread.jspa?messageID=273405