• 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
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Bear Bibeault
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh

Getting incorrect values from SQL query

 
Ranch Hand
Posts: 160
IntelliJ IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 754
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Hebert

Thank you for your response. All of my boolean fields are primitives.
 
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic