• Post Reply Bookmark Topic Watch Topic
  • New Topic

Native SQL: Left outer Join returns wrong data

Matthias Becker
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
    my overalls have superpowers - they repel people who think fashion is important. Tiny ad:
    the new thread boost feature brings a LOT of attention to your favorite threads
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!