hibernate - Setting subclass primary key as auto_increment using JPA 2 annotations -


I am trying to create a database schema for my project using hbm2ddl. I'm using JPA 2 annotations to specify how the schema should look like. Now I have some issues with the legacy ID.

I have an intangible superclass, let's call it an object class, which looks like this:

  @Entity @Inheritance (Strategy = InheritanceType.TABLE_PER_CLASS) public AbstractSuperClass {... @Id @ generatedValue (strategy = GenerationType.AUTO) Public long getId () {} ...}  

I 'We have an auto generated value ID that translates SQL's auto_interference barrier. However, when I look at the script I generated, I do not see the ID columns of those subclass tables, in which they have auto_interpretation.

Does anyone know how I can get it? Of course I can specify it manually but as much as possible I want to automate it.

Thank you.

In the section about legacy mapping, the reference document is not supported as mentioned in:

This strategy has many drawbacks (especially with polymorphic questions and associations) explained in JPA Speck, Hibernation, Reference Document, Hibernate in Action, and many other places. Most of them work around implementing this strategy by using SQL Union queries. This is usually used for the top level of a heritage hierarchy:

  @ Entity @ Inheritance (strategy = inheritance type.TABLE_PER_CLASS) The implementation of the public class flight serializable {...}  

This strategy provides one-to-many associations, provided they are related to bidirection. This strategy does not support the IDENTITY generator strategy: the ID must be shared in several tables. As a result, while using this strategy, you should not use auto or identity .


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -