From: <leg...@at...> - 2003-12-08 10:56:41
|
The following comment has been added to this issue: Author: Hunter Kelly Created: Mon, 8 Dec 2003 4:56 AM Body: Here is the output when run: cd /home/retnuh/stuff/hibernate/cvs/hibernate-2.1/eg1/test/ ant -find build.xml -emacs eg1 Searching for build.xml ... Buildfile: /home/retnuh/stuff/hibernate/cvs/hibernate-2.1/build.xml Could not load definitions from resource clovertasks. It could not be found. eg1: Compiling 1 source file to /home/retnuh/stuff/hibernate/cvs/hibernate-2.1/eg1 remember to place your JDBC driver in the lib directory 08-Dec-2003 10:55:30 net.sf.hibernate.cfg.Environment <clinit> INFO: Hibernate 2.1 rc1 08-Dec-2003 10:55:30 net.sf.hibernate.cfg.Environment <clinit> INFO: loaded properties from resource hibernate.properties: {hibernate.connection.driver_class=com.mysql.jdbc.Driver, hibernate.cglib.use_reflection_optimizer=true, hibernate.cache.provider_class=net.sf.hibernate.cache.HashtableCacheProvider, hibernate.max_fetch_depth=1, hibernate.dialect=net.sf.hibernate.dialect.MySQLDialect, hibernate.jdbc.use_streams_for_binary=true, hibernate.jdbc.batch_size=0, hibernate.query.substitutions=true 1, false 0, yes 'Y', no 'N', hibernate.proxool.pool_alias=pool1, hibernate.connection.username=root, hibernate.connection.url=jdbc:mysql:///thing, hibernate.connection.password=root, hibernate.connection.pool_size=1} 08-Dec-2003 10:55:30 net.sf.hibernate.cfg.Environment <clinit> INFO: using java.io streams to persist binary types 08-Dec-2003 10:55:30 net.sf.hibernate.cfg.Environment <clinit> INFO: using CGLIB reflection optimizer 08-Dec-2003 10:55:30 net.sf.hibernate.cfg.Configuration configure INFO: configuring from resource: /hibernate.cfg.xml 08-Dec-2003 10:55:30 net.sf.hibernate.cfg.Configuration getConfigurationInputStream INFO: Configuration resource: /hibernate.cfg.xml 08-Dec-2003 10:55:30 net.sf.hibernate.cfg.Configuration addResource INFO: Mapping resource: Thing.hbm.xml 08-Dec-2003 10:55:30 net.sf.hibernate.cfg.Binder bindRootClass INFO: Mapping class: test.Thing -> thing 08-Dec-2003 10:55:30 net.sf.hibernate.cfg.Binder bindRootClass INFO: Mapping class: test.UUIDThing -> uuidthing 08-Dec-2003 10:55:30 net.sf.hibernate.cfg.Binder bindRootClass INFO: Mapping class: test.IntThing -> otherthing 08-Dec-2003 10:55:30 net.sf.hibernate.cfg.Configuration doConfigure INFO: Configured SessionFactory: null 08-Dec-2003 10:55:30 net.sf.hibernate.cfg.Configuration secondPassCompile INFO: processing one-to-many association mappings 08-Dec-2003 10:55:30 net.sf.hibernate.cfg.Configuration secondPassCompile INFO: processing one-to-one association property references 08-Dec-2003 10:55:30 net.sf.hibernate.cfg.Configuration secondPassCompile INFO: processing foreign key constraints 08-Dec-2003 10:55:31 net.sf.hibernate.dialect.Dialect <init> INFO: Using dialect: net.sf.hibernate.dialect.MySQLDialect 08-Dec-2003 10:55:31 net.sf.hibernate.cfg.SettingsFactory buildSettings INFO: Maximim outer join fetch depth: 1 08-Dec-2003 10:55:31 net.sf.hibernate.cfg.SettingsFactory buildSettings INFO: Use outer join fetching: true 08-Dec-2003 10:55:31 net.sf.hibernate.connection.DriverManagerConnectionProvider configure INFO: Using Hibernate built-in connection pool (not for production use!) 08-Dec-2003 10:55:31 net.sf.hibernate.connection.DriverManagerConnectionProvider configure INFO: Hibernate connection pool size: 1 08-Dec-2003 10:55:31 net.sf.hibernate.connection.DriverManagerConnectionProvider configure INFO: using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql:///thing 08-Dec-2003 10:55:31 net.sf.hibernate.connection.DriverManagerConnectionProvider configure INFO: connection properties: {user=root, password=root} 08-Dec-2003 10:55:31 net.sf.hibernate.transaction.TransactionManagerLookupFactory getTransactionManagerLookup INFO: No TransactionManagerLookup configured (in JTA environment, use of process level read-write cache is not recommended) 08-Dec-2003 10:55:31 net.sf.hibernate.cfg.SettingsFactory buildSettings INFO: Use scrollable result sets: true 08-Dec-2003 10:55:31 net.sf.hibernate.cfg.SettingsFactory buildSettings INFO: echoing all SQL to stdout 08-Dec-2003 10:55:31 net.sf.hibernate.cfg.SettingsFactory buildSettings INFO: Query language substitutions: {no='N', true=1, yes='Y', false=0} 08-Dec-2003 10:55:31 net.sf.hibernate.cfg.SettingsFactory buildSettings INFO: cache provider: net.sf.hibernate.cache.HashtableCacheProvider 08-Dec-2003 10:55:31 net.sf.hibernate.cfg.Configuration configureCaches INFO: instantiating and configuring caches 08-Dec-2003 10:55:31 net.sf.hibernate.impl.SessionFactoryImpl <init> INFO: building session factory 08-Dec-2003 10:55:32 net.sf.hibernate.impl.SessionFactoryObjectFactory addInstance INFO: no JNDI name configured Exception in thread "main" net.sf.hibernate.PropertyValueException: not-null property references a null or transient value: net.sf.hibernate.persister.EntityPersister.thing at net.sf.hibernate.impl.SessionImpl.checkNullability(SessionImpl.java:1208) at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:873) at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:817) at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:737) at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:717) at net.sf.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:1319) at net.sf.hibernate.engine.Cascades$4.cascade(Cascades.java:114) at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:436) at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:503) at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:892) at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:817) at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:740) at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:717) at test.IntVsUUIDOneToOneTest.main(IntVsUUIDOneToOneTest.java:27) Java Result: 1 for more examples, download the hibernate-examples package BUILD SUCCESSFUL Total time: 4 seconds Compilation finished at Mon Dec 8 10:55:32 --------------------------------------------------------------------- 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:56 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 |
From: <leg...@at...> - 2003-12-08 11:37:41
|
The following comment has been added to this issue: Author: Hunter Kelly Created: Mon, 8 Dec 2003 5:37 AM Body: Is there a list where some of these gotcha's are listed? I've never seen anything about it in the documentation or the FAQs. And searching on the text of the error message in both Google and the forums yielded very little. I do not think that it is very well known. I don't understand, though, why was this rejected? Isn't this considered a bug? At the very least the error message should indicate where the problem is - in the fact that something has an int id and there is some strangeness there. H --------------------------------------------------------------------- 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: Closed Priority: Critical Resolution: REJECTED 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 5:37 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 |
From: <leg...@at...> - 2003-12-08 11:47:41
|
The following comment has been added to this issue: Author: Gavin King Created: Mon, 8 Dec 2003 5:47 AM Body: I agree it should be added to the FAQ. There are, however, some mentions in the forum. It is certainly not a bug. The Session does write-behind for all inserts except identity column inserts, since it is impossible in this special case. --------------------------------------------------------------------- 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: Closed Priority: Critical Resolution: REJECTED 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 5:47 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 |
From: <leg...@at...> - 2003-12-08 11:54:41
|
The following comment has been added to this issue: Author: Hunter Kelly Created: Mon, 8 Dec 2003 5:53 AM Body: I've just tested this in Hibernate-2.0.3 and it works. Something that works in one major release, and not in the next, is definately a bug. I actually first came across the issue last week when doing the upgrade from 2.0.3 to 2.1rc1. I don't mean to sound tetchy, I'm just trying to be helpful. I work on a real commercial product, and Hibernate has enabled us to do a tremendous amount in a very short period of time - I think it is, hands down, one of the best pieces of software that I've used. If there is something else I can do to help sort this out, please let me know. --------------------------------------------------------------------- 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: Closed Priority: Critical Resolution: REJECTED 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 5:53 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 |
From: <leg...@at...> - 2003-12-08 11:56:41
|
The following comment has been added to this issue: Author: Hunter Kelly Created: Mon, 8 Dec 2003 5:55 AM Body: Err, I was typing that last comment as your previous comment came in. Didn't mean a direct contradiction of what you'd just said - but it did actually work in 2.0.3. --------------------------------------------------------------------- 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: Closed Priority: Critical Resolution: REJECTED 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 5:55 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 |
From: <leg...@at...> - 2003-12-08 12:07:41
|
The following comment has been added to this issue: Author: Gavin King Created: Mon, 8 Dec 2003 6:07 AM Body: It didn't work in 2.0.3! At least, I don't see how it *could* have. You are mistaken, I think... --------------------------------------------------------------------- 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: Closed Priority: Critical Resolution: REJECTED 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 6:07 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 |
From: <leg...@at...> - 2003-12-08 12:24:41
|
The following comment has been added to this issue: Author: Hunter Kelly Created: Mon, 8 Dec 2003 6:24 AM Body: It does, I swear! I'll have to change the test to be a normal one-to-one mapping without the property ref, but it does work. As a quick and dirty, you can run it in th 2.0.3 tree (sax complains about property-ref), but the insert does work correctly. I'll update the example to be a normal (ie same id) one-to-one. --------------------------------------------------------------------- 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: Closed Priority: Critical Resolution: REJECTED 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 6:24 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 |
From: <leg...@at...> - 2003-12-08 12:28:41
|
The following comment has been added to this issue: Author: Hunter Kelly Created: Mon, 8 Dec 2003 6:28 AM Body: No, I stand corrected, it was working, but the type had been uuid's. There was some strangeness though, that forced me to change from uuid to int, and then things started blowing up... Anyway, I guess I've got enough for now. If you want me to draft up some kind of FAQ and an answer (you'll have to fill in the technical details), I'd be happy to. I do think it needs to be better documented, at least... --------------------------------------------------------------------- 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: Closed Priority: Critical Resolution: REJECTED 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 6:28 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 |