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

Getting incorrect values from SQL query

 
Riaan Nel
Ranch Hand
Posts: 160
IntelliJ IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys

I'm faced with a Hibernate problem which makes absolutely no sense. I have a fairly large query which joins a whole bunch of tables with outer joins. Among others, it selects a number of boolean fields. Whereas it looks like all of the other fields are populated, the object array returned by my query contains a null value for one of the boolean fields.

I ran Netbeans in debug mode, and I copied the query and executed it in my MySQL query browser immediately before it's executed by the entity manager. In MySQL, I get the expected result (i.e. a valid boolean value in that particular field). Any thoughts on why the query works in the query browser but not in my Java code? I'm stumped.

Thanks for your help.

Cheers,
Riaan
 
Hebert Coelho
Ranch Hand
Posts: 754
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is your booleans attributes as classes? or primitives?

I do not know if this is the problem, is just a thought....
 
Riaan Nel
Ranch Hand
Posts: 160
IntelliJ IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Hebert

Thank you for your response. All of my boolean fields are primitives.
 
abani patra
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I think you should use many-to-one ,many-to-many,one-to-one,one-to-many relation rather using join in query.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic