openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ljnelson <ljnel...@gmail.com>
Subject Re: How to find entity belong which EntityManger?
Date Mon, 13 Jun 2011 20:28:42 GMT
On Mon, Jun 13, 2011 at 4:25 PM, Pinaki Poddar [via OpenJPA] <
ml-node+6471682-2008051213-155969@n2.nabble.com> wrote:

> A method like this may work (I am writing this in an email, so no
> warranty;)
>
> /**
>   * Affirms if the class of the given instance belongs to the given
> metamodel.
> **/
> boolean contains(Metamodel m, Object instance) {
>    Set<EntityType<?>> pTypes = m.getEntities();
>    for (EntityType<?> pType : pTypes) {
>         if (instance.getClass() == pType.getJavaType())
>               return true;
>    }
>    return false;
> }
>

...and I made the mistake of reading the original poster's problem code too
quickly and assumed that this (generally speaking) was what he was doing.
Obviously, as you pointed out, that is NOT what he was doing.

Thanks for the (second-order :-)) education.

Best,
Laird


--
View this message in context: http://openjpa.208410.n2.nabble.com/How-to-find-entity-belong-which-EntityManger-tp6470903p6471693.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message