Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JPA/Hibernate entity mapping error?

 
Vladimir Kroupa
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I'm using JPA with Hibernate 3.5.6 as the persistence provider. I've mapped some entities using JPA annotations and I'm using database schema generated by Hibernate, but I'm encountering incorrect SQL insert statements in runtime when trying to persist on of the entities.
Here are the entitites:



The Player entity looks like this:


The schema generated by Hibernate looks like this:


When I try to persist the MatchEntity, one of the generated insert statements is incorrect. Table Game_Player has three columns, not two.


Does anyone have an idea what could be wrong? I don't think that the interface types are causing the problems, I have the target entities specified and I tried to get rid of the interface types and the problem didn't go away.
I'll be grateful for any tips.
Vladimir
 
Vladimir Kroupa
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can now confirm that this is not Hibernate specific. I tried swapping Hibernate for OpenJPA. The insert statement generated when trying to persist the MatchEntity has the same problem:



It has to be a problem with JPA mapping. But it still don't see where
 
Vladimir Kroupa
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you would like to see the problem for yourself, you can checkout my Maven project from http://my-svn.assembla.com/svn/kroupv1/football. I'm using hsqldb and Maven Jetty plugin, so you won't have to configure anything. Just use the jetty:run goal.
If you are using an OS that doesn't have the /tmp directory, you might want to change the DataSource url property in the dao.xml Spring configuration file.

Thanks to anyone who donates his time!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic