• Post Reply Bookmark Topic Watch Topic
  • New Topic

Hibernate, Inheritance of entities.. One table too much..

 
Jeroen Bs
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying generate a database schema but I end up with an extra table I don't want. My creation looks like this (well its a bit (much ?) simplified):



contactProcess.java (Extends from myProcess)


CreateContactProcess.java(Extends from ContactProcess)


This all works as expected but there is one thing I don't like about it. Because the CreateContactProcess contains the @Entity annotation, a table in the database is created with the name CreateContactProcess. This table contains one column and thats the id column. Is there a way to prevent hibernate to create the CreateContactProcess ?
Removing the @Entity annotation lets hibernate generate the right tables but as expected breaks my code and prevents me to persist my entities.

I'm trying to find a solution for problem for a couple of days and can't find a solution.. so any hibernate guru around here who know how to fix it ? (Without me having to patch hibernate itself )
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you specify the inheritance strategy mapping for ContactProcess it should work I think.
 
Jeroen Bs
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Sturrock wrote:If you specify the inheritance strategy mapping for ContactProcess it should work I think.

I tried all the possible settings for InheritanceType
  • @Inheritance(strategy = InheritanceType.JOINED)
  • @Inheritance(strategy = InheritanceType.SINGLE_TABLE)
  • @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)

  • in ContactProcess but it doesn't change a thing how hibernate generates the tables. I dropped the entire DB for every try and it still creates the CreateContactProcess table.
     
    What are you doing? You are supposed to be reading this tiny ad!
    the new thread boost feature brings a LOT of attention to your favorite threads
    https://coderanch.com/t/674455/Thread-Boost-feature
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!