Hello,

I have this construct:

@Entity
class PickOrder {
  @OneToOne(optional = false, fetch = FetchType.EAGER)
  @PrimaryKeyJoinColumn(name = "auf_nr")
  OrderProgress progress;
}

@Entity
@Table(name = "order_infos")
public class OrderProgress {
    @Id
    @Column(name = "auf_nr", length = 18)
    String id;

    float done_percent;
    float shortfalls_percent;
    int shortfalls;
}

When calling "select o from PickOrder" the progress object is never
filled with the data from the table (which is a view actually).
When I call "select o from PickOrder where o.id=1" it is sometimes
fetched sometimes not. The generated SQL is correct. Any Ideas what
might cause such a behaviour on H2 (HSQL)? The generated SQL does not
contain JOINs but its rather 2 calls to the DB first getting the
PickOrder list and then for each order a select to the order_infos
table is made.

Log-Output from EclipseLink:
[EL Finest]: Execute query ReadAllQuery(referenceClass=LegacyPickOrder
sql="SELECT t0.auf_nr, t0.ZUSATZTEXT, t0.VOLUMEN, t0.prioritaet,
t0.typ, t0.ANZAHL_COLLI, t0.QUITTIERUNGSDATUM, t0.EINGANGSDATUM,
t0.status, t0.ANZAHL_POSITIONEN, t0.TOR_PZ, t0.TOR,
t0.ANZAHL_PALETTEN, t0.gewicht FROM auftraege t0, order_infos t1 WHERE
(((t1.SHORTFALLS > ?) AND (t0.QUITTIERUNGSDATUM > ?)) AND (t1.auf_nr =
t0.auf_nr)) ORDER BY t0.QUITTIERUNGSDATUM ASC")
[EL Fine]: Connection(12944434)--SELECT auf_nr, SHORTFALLS,
SHORTFALLS_PERCENT, DONE_PERCENT FROM order_infos WHERE (auf_nr = ?)
        bind => [14]
[EL Fine]: Connection(23986467)--SELECT auf_nr, SHORTFALLS,
SHORTFALLS_PERCENT, DONE_PERCENT FROM order_infos WHERE (auf_nr = ?)
        bind => [5]
[EL Fine]: Connection(12944434)--SELECT auf_nr, SHORTFALLS,
SHORTFALLS_PERCENT, DONE_PERCENT FROM order_infos WHERE (auf_nr = ?)
        bind => [7]
and so on for each fetched order.

What puzzles me is that if I refresh very very quickly, I sometimes
get the expected values from the database into the Entities. Shouldn't
the query be a JOIN query anyway?

Thanks,
Phil

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to