Hello,
I'm using Hibernate 3.0. I have a strange effect when using a criteria query running on postgres 8.0:
return session.createCriteria(Person.class)
.add(Expression.and(Expression.eq("userid", userid), Expression.eq("vsnr", vsnr))
.uniqueResult();
The Person.class has a set to a PersonGroup.class what I think causes the problem:
* @hibernate.set
* inverse = "true"
* cascade = "all-delete-orphan"
* lazy = "false"
*
* @hibernate.collection-key
* column = "person"
* @hibernate.collection-one-to-many
* class = "PersonGroup"
And this are the SQL that are generated:
select this_.id as id0_, this_.VERSION as VERSION2_0_, this_.nachname as nachname2_0_, this_.titel as titel2_0_, this_.vorname as vorname2_0_, this_.vsnr as vsnr2_0_, this_.userid as userid2_0_ from person this_ where (this_.userid=? and this_.vsnr=?)
select persongrup0_.person as person__, persongrup0_.id as id__, persongrup0_.id as id1_, persongrup0_.VERSION as VERSION4_1_, persongrup0_.gruppe as gruppe4_1_, persongrup0_.person as person4_1_, persongrup0_.userid as userid4_1_, gruppe1_.id as id0_, gruppe1_.VERSION as VERSION3_0_, gruppe1_.beschreibung as beschrei3_3_0_, gruppe1_.name as name3_0_, gruppe1_.userid as userid3_0_ from person_gruppe persongrup0_, gruppe gruppe1_ where persongrup0_.gruppe=gruppe1_.id(+) and persongrup0_.person=?
As you can see, the second SQL is invalid as it contains a construct like gruppe1_.id(+). Is this a hibernate bug or is it a wrong definition?
Thx
Rene
|