• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JPA/Hibernate entity mapping error?

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
reply
    Bookmark Topic Watch Topic
  • New Topic