You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by Fr...@capgroup.com on 2008/04/08 21:53:10 UTC

Add 2 methods to OpenJPAPersistence

Proposal to add 2 methods to OpenJPAPersistence:

Could we add the following 2 methods that would conceptually do the
following?

// o is a persistence capable object.

public static Object getObjectId(Object o)  {
      return OpenJPAPersistence.getEntityManager(o).getObjectId(o);
}

and

static public Object getOpenJPAObjectId(Object o) {
            Object objId =
OpenJPAPersistence.getEntityManager(o).getObjectId(o);
            return
JPAFacadeHelper.toOpenJPAObjectId(JPAFacadeHelper.getMetaData(o), objId);
}

This would save quite some typing...

Frederic

PS: the code inside is just to illustrate the intent - it should of couse
be optimized.