[ 
https://issues.apache.org/jira/browse/DELTASPIKE-948?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Daniel Cunha (soro) updated DELTASPIKE-948:
-------------------------------------------
    Description: 
We use PersisteceUnitUnitl for it, however - see the javadoc for it: 
http://docs.oracle.com/javaee/6/api/javax/persistence/PersistenceUnitUtil.html#getIdentifier%28java.lang.Object%29

Solution:
I guess the only portable check is EntityManager#contains and if it returns 
false a #load with the id >if< the id is available, the part with #contains 
just to be faster with entities which are really loaded by the em, well - 
instead of #load a count query would be better to avoid that it really loads 
the entity.

  was:
Ww use PersisteceUnitUnitl for it, however - see the javadoc for it: 
http://docs.oracle.com/javaee/6/api/javax/persistence/PersistenceUnitUtil.html#getIdentifier%28java.lang.Object%29

Solution:
I guess the only portable check is EntityManager#contains and if it returns 
false a #load with the id >if< the id is available, the part with #contains 
just to be faster with entities which are really loaded by the em, well - 
instead of #load a count query would be better to avoid that it really loads 
the entity.


> CdiQueryInvocationContext#isNew isn't portable across jpa providers
> -------------------------------------------------------------------
>
>                 Key: DELTASPIKE-948
>                 URL: https://issues.apache.org/jira/browse/DELTASPIKE-948
>             Project: DeltaSpike
>          Issue Type: Improvement
>            Reporter: Daniel Cunha (soro)
>            Assignee: Daniel Cunha (soro)
>
> We use PersisteceUnitUnitl for it, however - see the javadoc for it: 
> http://docs.oracle.com/javaee/6/api/javax/persistence/PersistenceUnitUtil.html#getIdentifier%28java.lang.Object%29
> Solution:
> I guess the only portable check is EntityManager#contains and if it returns 
> false a #load with the id >if< the id is available, the part with #contains 
> just to be faster with entities which are really loaded by the em, well - 
> instead of #load a count query would be better to avoid that it really loads 
> the entity.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to