Hi all,
I don't know if I should call it a hibernate bug If ound because it only appears with MySQL 4.1.3 which is not on the compatibility list. Or I made a mistake which only causes problems with MySQL 4.1.3. So please let me know if I made sth. wrong.
I post this because it could become interesting if one would also support MySQL 4.1.x
My Hibernate Version is 2.1.4
Os Win XP
And the problem:
I have between many others two classes. They're called User and 'DGKUser'
There is a one to one association between them. One youser _could_ also have a DGKUser - but this is optional. I needed to have a ' unique foreign key association' and not a 'primary key association'.
If all my Users have a DGKUser everything seems to be fine. But when there is one without a DGKUser strange things happen.
If I load a list of users (with find(..)) Only the users with a DGKUser are returned until the first one (orderd by primary keys) without that DGKUser
comes. But the returned set has the correct size.
Another phenomenon: My User has also an association to another class 'Veranstalter'. If I do load an user with DGKUser again everything is fine. If the User has no DGKUser he also has no 'Veranstalter' - but in the DB is a reference.
There is nothing which is logged.
So now the snippets for the User:
....
<many-to-one
name="dgkUser"
class="de.ecoware.etap.persistenz.model.DGKUser"
cascade="all"
outer-join="auto"
update="true"
insert="true"
access="property"
column="DGK_ID"
unique="false"
/>
(Please not that unique="true" produces the same.)
<many-to-one
name="veranstalter"
class="de.ecoware.etap.persistenz.model.Veranstalter"
cascade="all"
outer-join="auto"
update="true"
insert="true"
access="property"
column="FK_VERANSTALTER_ID"
/>
And the DGKUser:
...
<one-to-one
name="user"
class="de.ecoware.etap.persistenz.model.User"
cascade="all"
outer-join="auto"
constrained="false"
property-ref="dgkUser"
/>
So again: With MySQL 4.0.x (tested with 4.0.1 and 4.0.3 on three systems) everything is ok. But MySQL 4.1.3 on the same systems produces that strange behavior.
It would be kind if one could tell me whether I made a mistake, MySQL is the one to blame or if there is an inkompatibility between hibernate and MySQL 4.1.
Greets,
helge
|