Changing properties in Lifecycle sometimes doesn't work
-------------------------------------------------------

                 Key: QI-272
                 URL: http://issues.ops4j.org/browse/QI-272
             Project: Qi4j
          Issue Type: Bug
          Components: Core Runtime
    Affects Versions: 1.2
         Environment: Qi4j.
            Reporter: Stanislav Muhametsin
            Assignee: Rickard Öberg
             Fix For: 1.3
         Attachments: lifecycle_test.zip

If a mixin implementing Lifecycle method tries to change state of entities, the 
behaviour splits in three parts.
1. If entity is created via UnitOfWork's newEntity method, the constraints are 
checked. This might result in ConstraintViolationException being thrown.
2. If entity is created via EntityBuilder's newInstance method, the constraints 
are not checked. IMHO this is the desired behaviour.
3. If mixin overrides Property<...> methods, and is created via EntityBuilder's 
newInstance method, the property values are set incorrectly.

The test case is attached. For case nr 3, my educated guess is that in 
JSONEntityState, the stateName.name() is used instead of stateName.toString() 
when setting properties. Additionally, the identity -property is outside the 
normal properties-object, which means that if user changes the identity() 
property for entity prototype, it won't get updated.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.ops4j.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev

Reply via email to