Hibernate ignores @Table (name = "...") for extended classes - created table names - all lowercase

We create our tables automatically using Hibernate, assigning:

@Table(name = "some_table") 

This worked for "normal" objects. But when we have an abstract base class:

 @Entity @Inheritance(strategy = InheritanceType.SINGLE_TABLE) public class PersonBankAccount extends AbstractPersistable<Long> { 

which expands to

 @Entity @Table(name = "person_bank_account") public class PersonBankAccountSimple extends PersonBankAccount { 

The resulting table in the database is called

 personbankaccount 

What's going on here?

The auto generator says:

 table not found: PersonBankAccount 

upon first creation and repetition, he says:

 table found: personbankaccount 

As I said, everything works fine for regular tables.

+4
source share
1 answer

Instead, there should not be a table name in the base class.

 @Entity @Inheritance(strategy = InheritanceType.SINGLE_TABLE) @Table(name = "person_bank_account") public class PersonBankAccount extends AbstractPersistable<Long> { 
+6
source

Source: https://habr.com/ru/post/1387580/


All Articles