Hi,
I'm having a problem with a map declaration and I don't know if I'm doing something wrong or it's another problem.
I have the following mapping in my User class:
<map name="userProjects" table="USER_PROJECT" cascade="all-delete-orphan">
<key column="serialNum" />
<map-key column="PDOCID" type="string" />
<many-to-many class="Project" />
</map>
The problem is the generated query to populate this map:
select userprojec0_.SERIALNUM as SERIALNUM1_, userprojec0_.elt as elt1_, userprojec0_.PDOCID as PDOCID1_, project1_.PDOCID as PDOCID0_, project1_.VERSION as VERSION38_0_ from omr.USER_PROJECT userprojec0_
inner join omr.PROJECT project1_ on userprojec0_.elt=project1_.PDOCID
I don't know why hibernate is 'selecting a non-existing' column userprojec0_.elt as elt1_
The correct query should be:
select userprojec0_.SERIALNUM as SERIALNUM1_, userprojec0_.PDOCID as PDOCID1_, project1_.PDOCID as PDOCID0_, project1_.VERSION as VERSION38_0_
from omr.USER_PROJECT userprojec0_
inner join omr.PROJECT project1_ on userprojec0_.PDOCID=project1_.PDOCID
Can't I use the same property in the map-key and in the many-to-many?
Thanks,
Cristiane
|