TableGenerator « Map « JPA Q&A





1. JPA @TableGenerator shared between multiple entities    stackoverflow.com

I have a 'dog' Entitiy with an @Id and a @TableGenerator

...
@TableGenerator(table = "seq", name = "dog_gen", pkColumnName = "seq_name", valueColumnName="seq_val")
@Id @GeneratedValue(strategy = GenerationType.TABLE, generator = "dog_gen")
private Long id;
...
Is there a way ...

2. What's the reason behind the jumping GeneratedValue(strategy=GenerationType.TABLE) when not specifying a @TableGenerator?    stackoverflow.com

Why do I need to add allocationSize=1 when using the @TableGenerator to ensure that the id wouldn't jump from 1, 2,... to 32,xxx, 65,xxx,... after a jvm restart? Is there a design ...

3. When to use @TableGenerator?    stackoverflow.com

Can you tell me when to use it and why should I create a new table just for keeping primary key while most DBMS now support auto increment and you can ...

4. Hibernate tries to create same Entity/Table twice when @TableGenerator is used - how to avoid it?    stackoverflow.com

Hi All,
I am using hibernate with my J2EE app deployed on JBoss 6.0.
My database is Oracle 11i and Derby.
For generating primary-key (running serial Id) I use @TableGenerator annotation 
in one of ...

5. Scalable sequential ID generator for related entities using @TableGenerator    stackoverflow.com

I am writing a web-application where some IDs will be visible to the users in the URL. The application is meant to be used by more users having each an Account. ...

6. Can @TableGenerator save the last used id in the table instead of the next available?    stackoverflow.com

I need to connect to a vendor db and insert customer data. The sequence table used to generate new customer ids stores the last used id (not the next available). ...

7. JPA 1.0 - How to override @TableGenerator in subclass    coderanch.com

Hi developers, I am facing a problem I have found no solution to yet surfing the web. Any help would be appreciated. It's about JPA 1.0 persistence and how pKey generation is handled when class hierarchies and mappedsuperclasses are involved. My Base Class is like: @MappedSuperclass public class Person{ @Id @GeneratedValue(strategy = GenerationType.TABLE, generator = "DDD_GEN") @TableGenerator(name="DDD_GEN", table="TMP_SEQUENCE", allocationSize=1) private long ...

8. @TableGenerator incrementing table value x100    forum.hibernate.org

We're using @TableGenerator as our ID generation mechanism, but we're seeing some odd results on a handful of our entities. The "value" of the stored id is being multiplied by a factor of 100 before being used as an ID. This results in a id "value" of 4002 being persisted as 400200. Our generator annotation: Code: @TableGenerator( ...

9. @Tablegenerator throws unsupported exception    forum.hibernate.org

We have Hibernate 3.3.1 with Websphere 6.1 - EJB3 feature pack. There are Stateless session beans injected with Entitymanager with Hibernate as the JPA provider. While using @Tablegenerator with GenerationType.TABLE strategy, Hibernate throws UnsupportedException - Cannot perform isolated work. The transaction manager lookup class used id WebsphereExtendedJTATransactionLookup with CMTTransactionFactory. It appears that the Isolater.java tries to suspend the transaction while generating ...





10. problem with @TableGenerator when allocationSize > 1    forum.hibernate.org

Hi, I'm using hibernate 3.5.0-CR2 with MySQL server 5.1.44 (through mysql-connector-java-5.1.9) on Windows. I'm using JPA 2.0 and using the @TableGenerator to generate ids as below: @Id @GeneratedValue(strategy=GenerationType.TABLE, generator="EnterpriseSequence") @TableGenerator(name="EnterpriseSequence", table="sequencetable", pkColumnName="sequenceName", valueColumnName="sequenceCount", pkColumnValue="EnterpriseSequence", allocationSize=1) private long id; When allocationSize=1 then everything works fine. The ids are generated and the sequence count in the database is updated. But when allocationSize > ...

11. How @TableGenerator works behind the scene?    forum.hibernate.org

12. How to substitute custom Id generator for @TableGenerator    forum.hibernate.org

Need help with Hibernate? Read this first: http://www.hibernate.org/ForumMailingli ... AskForHelp Hibernate version:3.2.4 Name and version of the database you are using: MS SQL Server 2005 We have a table that is used for generation of IDs through legacy code (stored procedures). At the same time we have JPA entities for which we would like to use standard @TableGenerator annotation as follows: ...