Win a copy of Machine Learning with R: Expert techniques for predictive modeling this week in the Artificial Intelligence and Machine Learning forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Queries and "column not found" error

 
Ranch Hand
Posts: 106
Hibernate Python MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm really having a hard time getting a DB design to work with Hibernate. I have several kinds of composite keys and some IDs as well, but nearly anything that could be considered exotic. The latest strangeness of Hibernate producing an error on the native query:



Hibernate chokes with an error that appears to be completely unrelated (there's only a multi-column many-to-one association in PlayerStats):



Somehow Hibernate seems to be expecting a column here, but again the association is multi-column. Regarding this issue I stumbled across: http://docs.jboss.org/hibernate/core/3.3/reference/en/html/querysql.html#d0e13696

A paragraph here reads:

If the entity is mapped with a many-to-one to another entity it is required to also return this when performing the native query, otherwise a database specific "column not found" error will occur. The additional columns will automatically be returned when using the * notation...



Well, this is nice to know, but how do you avoid this error?

Here's the design: http://www.kawoolutions.com/media/hibernate-wrong-sql-playerstats.jpg
Please have a look at the PlayerStats table being connected to two other tables via a composite key of composite keys. Here's its class:



I have no idea what Hibernate is doing here. I really need some help on this.

Karsten
 
Where all the women are strong, all the men are good looking and all the tiny ads are above average:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!