Message:
A new issue has been created in JIRA.
---------------------------------------------------------------------
View the issue:
http://opensource.atlassian.com/projects/hibernate/secure/ViewIssue.jspa?key=HB-531
Here is an overview of the issue:
---------------------------------------------------------------------
Key: HB-531
Summary: One-To-One mappings with int/native ids don't work properly
Type: Bug
Status: Unassigned
Priority: Critical
Project: Hibernate2
Components:
core
Versions:
2.1 final
2.1 rc1
Assignee:
Reporter: Hunter Kelly
Created: Mon, 8 Dec 2003 4:49 AM
Updated: Mon, 8 Dec 2003 4:49 AM
Environment: RedHat Linux 9.0
MySQL 4.0.14-standard
Latest Hibernate CVS tree
Description:
I have a one to one mapping in a class, Thing, that maps to IntThing and UUIDThing.
IntThing and UUIDThing both define a many-to-one mapping back to Thing.
Int thing uses "native" generator for id. UUID uses "uuid.hex" generator for id.
I would have thought they'd behave the same, but they don't.
I've built a truth table for each, where I changed the values of the "constrained" attribute
on the one-to-one mapping and the "not-null" attribute on the many-to-one mapping.
For UUID thing:
Constrained = true | Constrained = false
-------------------------------------------------------
Not-Null | |
true | failed | sucess
-------------------------------------------------------
Not-Null |
false | success | success
-------------------------------------------------------
For Int thing:
Constrained = true | Constrained = false
-------------------------------------------------------
Not-Null| |
true | failed | failed
-------------------------------------------------------
Not-Null| |
false | success | failed
-------------------------------------------------------
The above chart shows that regardless of what constrained is set to,
you can't have a one-to-one mapping to an entity with an int id type that has
a not-null constraint back to the parent.
I'll attach the files now - to compile and run I just made a copy
of the "eg" target in Hibernate's build.xml, uncommented the
lines in hibernate.properties relevant to MySQL and changed the database name.
---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
|