[
http://issues.ops4j.org/browse/QI-272?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13605#action_13605
]
Niclas Hedhman commented on QI-272:
-----------------------------------
1. This is probably related to the internal sequencing, i.e. the Entity is
created prior to life cycle methods called.
2. Whereas here, the EntityBuilder is using a 'special form' of the Entity
where the constraints are not checked.
3. I don't understand what you mean by "overriding Property methods".
And this
this._meAsEntity.identity().set( ENTITY_ID );
I would defend to be invalid, both for uow.newInstance() and
uow.newEntityBuilder().newInstance()
There are strong reasons not to fool the client code that the identity created
there is not what goes into the code, and if the EntityBuilder variant actually
works, then THAT is the bug, not that the uow.newInstance() can't modify it.
> 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