• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Native SQL: Left outer Join returns wrong data

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
as i belive I initally posted this question in the wrong forum
I have a problem running native queries with hibernate.
When I execute this query:


with this as data in the order data table (columns: dataSource, orderNumber, supplierNumber, customerNumber)

  • G 101967 O1 100999
    G 101968 O1 100999
    G 101969 O1 100999
    T 101967 O1 100999
    T 101968 O2 100999
    T 101969 O1 49978


  • I expect to get this result (as returned by the eclipse sql scrap book):

  • 101967 101967 100999 100999 O1 O1 T G
    101968 101968 100999 100999 O2 O1 T G
    101969 NULL 49978 NULL O1 NULL T NULL


  • Yet, when I execute this with Hibernate using this statement:

    I get a String array with this values (notive that the second row should contain "O1 O2" and the 3rd the null values):

  • [101967, 101967, 100999, 100999, O1, O1, T, T]
    [101968, 101968, 100999, 100999, O2, O2, T, T]
    [101969, 101969, 49978, 49978, O1, O1, T, T]

  • Why? The value for the supplier number of 101969 (100999 vs. 49978) is different so hibernate should return null values as does the sql scrap book for these entries.

    Thanks in advance for you help
     
    reply
      Bookmark Topic Watch Topic
    • New Topic