Zdravim konferenciu,
mam select a subselect kde pouzivam tu istu tabulku:
from aBid aBid where aBid.freight = ? " +
"and aBid.bidPrice = (" +
"select min(b.bidPrice) " +
"from aBid b " +
"where b.freight = aBid.freight)
co vytvori nasledovny SQL select:
select
abid0_.id as id31_,
.....
from
a_bid abid0_
where
abid0_.fk_freight_id=?
and abid0_.bid_price=(
select
min(abid0_.bid_price)
from
a_bid abid0_
where
abid0_.fk_freight_id=abid0_.fk_freight_id
// tu je PROBLEM
)
co nemoze fungovat pretoze pre obidve pouzitia tabulky vytvori HIBERNATE
rovnaky alias abid0_
abid0_.fk_freight_id=abid0_.fk_freight_id
ako mam donutit HIBERNATE aby vytvoril pre druhe pouzitie tabulky abid
alias napr. abid1_
teda nieco taketo:
select
abid0_.id as id31_,
.....
from
a_bid abid0_
where
abid0_.fk_freight_id=?
and abid0_.bid_price=(
select
min(abid1_.bid_price)
from
a_bid abid1_
where
abid1_.fk_freight_id=abid0_.fk_freight_id
)
dakujem
Ivan