Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Unable to call Scalar HQL Query from client

 
luke brown
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am trying to call results from a named HQL query in the hbm file from my test client but getting null as the output.


My testclient:



Employee1.java:






employee3.hbm:





hibernate.cfg:



While executing the .class output for the map keys comes out to be null .



what needs to be corrected to get proper values of eid and fname.


Thanks


Luke


 
Dave Tolls
Ranch Hand
Posts: 2112
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From the Hibernate docs for Query:
"You may not mix and match JDBC-style parameters and named parameters in the same query."

Which you are doing here:


Pick one or the other.
 
luke brown
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dave Tolls wrote:From the Hibernate docs for Query:
"You may not mix and match JDBC-style parameters and named parameters in the same query."

Which you are doing here:


Pick one or the other.


But the same query works fine with non scalar type ie

"select * from Employee1 eb where eb.eid < ? or eb.fname like :p"

 
Dave Tolls
Ranch Hand
Posts: 2112
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your choice if you want to ignore the documentation, but you are in an area that Hibernate itself says is not intended to work.

What happens if you change it to both positional, or both named?
Does it work as expected?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic