File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Jeroen Bs
Greenhorn
Posts: 9
  • 0
  • 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
  • 0
  • 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
  • 0
  • 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.
     
    I agree. Here's the link: http://aspose.com/file-tools
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic