wood burning stoves 2.0*
The moose likes Object Relational Mapping and the fly likes JPA/Hibernate entity mapping error? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "JPA/Hibernate entity mapping error?" Watch "JPA/Hibernate entity mapping error?" New topic
Author

JPA/Hibernate entity mapping error?

Vladimir Kroupa
Greenhorn

Joined: Dec 26, 2008
Posts: 28
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

Joined: Dec 26, 2008
Posts: 28
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

Joined: Dec 26, 2008
Posts: 28
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!
 
GeeCON Prague 2014
 
subject: JPA/Hibernate entity mapping error?