[ 
http://issues.ops4j.org/browse/QI-274?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13720#action_13720
 ] 

Stanislav Muhametsin commented on QI-274:
-----------------------------------------

I don't have the usecase anymore, as it went away with refactoring. I don't 
remember if there was much difference, but I think main problem is that 
prototype state (IIRC) does not check constraints, and actual state does. So, 
if lifecycle method temporarily needs to put entity state into invalid state, 
it will work when using  entity builder, but it won't work when using 
uow-method. This is quite indeterministic behaviour though, and that is never a 
good thing.

Solution suggestions: either make it use normal entity state ALWAYS at this 
point, or add (or does there already exist?) a way to check from within 
lifecycle method, whether it is prototype state or normal state.

> Different behaviour in UnitOfWork.newEntity(...) and 
> EntityBuilder.newInstance()
> --------------------------------------------------------------------------------
>
>                 Key: QI-274
>                 URL: http://issues.ops4j.org/browse/QI-274
>             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: creating_entity.zip
>
>
> When creating an entity via UnitOfWork.newEntity() method, it gets 
> initialized in a different way than when creating it via 
> EntityBuilder.newInstance(). If one has Lifecycle-mixin, that mixin gets 
> actual entity state when using UoW method, and gets prototype state when 
> using EntityBuilder.
> If this is not a desired behaviour, then one way of doing things should be 
> chosen and used uniformly throughout the APIs designated for creating an 
> entity.
> If this is a desired behaviour, then it should be clearly documented. 
> Additionally, there must be a way to check via API whether the state is 
> prototype or actual instance.
> Test-case attached.

-- 
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