Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Blocker
-
Resolution: Cannot Reproduce
-
Affects Version/s: 1.0
-
Fix Version/s: 1.0.2
-
Component/s: Persistence
-
Labels:None
Description
Composite Key Domains won't be updated!!
Example:
class T implements Serializable { static mapping = { id composite:['x', 'y'] } ...
TController:
def update = {
def T = T.get(new T(x:X.get(params.xid),y:Y.get(params.yid)))
// Here I have my T Object!
if (T) {
// To set the properties is senseless! Hibernate doesn't perform an update
T.properties = params
if (!T.hasErrors() && T.save(flush:true)) {
redirect...
}
} ....
After the work of the controller, nothing changed!! I tried it also with getting my T Object with findByXandY ..
Seems, that the Object hasn't been bound to the Hibernate session.
This works fine as far as I can see. I have written a test that verifies this behaviour:
http://svn.codehaus.org/grails/trunk/grails/test/groovy/org/codehaus/groovy/grails/orm/hibernate/CompositeIdentityUpdateTests.groovyIf it is the composite id fields you are trying to update that won't work, they're primary keys and not updateable
http://svn.codehaus.org/grails/trunk/grails/test/groovy/org/codehaus/groovy/grails/orm/hibernate/CompositeIdentityUpdateTests.groovy