[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[List Home]
|
[eclipselink-users] @OneToOne and @PrimaryKeyJoinColumn do not fetch the object on H2/HSQL database
|
- From: Philipp Kursawe <phil.kursawe@xxxxxxxxx>
- Date: Tue, 21 Jul 2009 10:28:34 +0200
- Delivered-to: eclipselink-users@eclipse.org
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:content-type :content-transfer-encoding; bh=fDKO9XJ7jmrrtKMPwoS5GWn9Igwnt2OeTRZRlcDa+D0=; b=BkjWh/wPruKkXSOZYNyo0WxlztTItSAb5w3xpTUhxPf28s8gskoLD/LAByOZjU2+6v wRnF8q6fyUutYo8p4OlS1wLfNHnG0XpYobNZPrvpKEySsENOYSxSRH7R8PWUuLcFJB35 ejRCDQWqATEakAv8Zt2fLOmFkjVrRK8Kg3TNc=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; b=EJ8hnAKHseCyCLJ80ZlaAozXjk8T5kwYtmGr0ioq44FgR8ufBdxGS1jSiBY0mBoeXl ztX31nuG0hGk76PWZsA7L1z8nYuusX8aNd955pqBQUP/vuPcFkYh6WYOIrBWsq7Mjzxk d+UN3R0LUI7Bffo2gSjxxUE8g4v4f2h3A2tOM=
- User-agent: Thunderbird 2.0.0.22 (Windows/20090605)
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 implements Comparable<OrderProgress> {
@Id
@Column(name = "auf_nr", length = 18)
String id;
float done_percent;
float shortfalls_percent;
int shortfalls;
public OrderProgress() {
}
@Override
public String toString() {
String value = this.done_percent + "%"; //$NON-NLS-1$
if (this.shortfalls_percent > 0.f) {
value += " [" + this.shortfalls_percent + "%]"; //$NON-NLS-1$
//$NON-NLS-2$
}
return value;
}
public int compareTo(final OrderProgress o) {
float result = this.done_percent - o.done_percent;
if (result == 0.f) {
result = this.shortfalls_percent - o.shortfalls_percent;
}
return (int) result;
}
}
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.
Thanks,
Phil