Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error in named native query (Invalid Column Name)

 
Dominique Von Hofcheirken
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi There,

I am trying to get a native query work. I put it in a mapping file:



The code to have it is the following:



Strangely, I got the exception:



Any ideas??
Many Thanks in advance.
 
Andreas Erber
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Dominique,

how is someone supposed to solve a problem with a query on a table if the table layout is unknown? Sorry, I can't do that, my crystal ball is currently in repair...

Post some info on the table you are querying or a mapping file that produces the query. Then, maybe someone can help...

CU
Froestel
 
Dominique Von Hofcheirken
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Andreas,

you're right!:P
However, I solved the issue.
The problem is that Hibernate tries to retrieve all mapped columns specified for DataValues objects, even if I specified only to get tow of them in the following named query in the mapping document:



Then the strange error:
could not read column value from result set: PK1_8_0_; Invalid column name

Then, I created a new mapping document and a new mapped object to exactly fit the query:



Do you think it's a normal behavior?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic