Community
Participate
Working Groups
Build Identifier: org.eclipse.emf.teneo-1.1.2-v201007191154 I have an EClass which has a boolean field. Using the session.merge() method, I persist a value for which the boolean field is set to false. In the EObject returned by the merge() method, the boolean field is set to null. I think this happens because of the following: * In org.eclipse.emf.teneo.hibernate.mapping.property.EAttributePropertyHandler, in the set() method, Teneo first retrieves the current value of the field that's about to be set. * If the current value is the same as the new value that came back from the DB, Teneo skips setting the field. * The problem is that, for a boolean field, retrieving the current value gives the value false, even when the actual field value is null. This is because there is logic in org.eclipse.emf.ecore.impl.EStructuralFeatureImpl.InternalSettingDelegateSingleData (line 1962) which says if the value of the field is null, return the defaultValue (which for boolean is false). Reproducible: Always Steps to Reproduce: 1. Define an EClass that has a boolean field (xsd:boolean when generating Ecore from XSD). 2. Using the merge() API, persist an instance of the type that has a false boolean value. The value is written to the DB, but the EObject returned by the merge() call will have the value null in the boolean field.
I added a test case in Assembla (r74).
Hi, A solution for non-eav cases has been committed to cvs and will be in the next build. Another issue I found is that merge does not work for EAV, I will send a separate email on this. Note that EMF default value handling is a bit specific (as you noted), see this lengthy discussion thread on the topic: http://www.eclipse.org/forums/index.php?t=tree&th=161533& gr. Martin