openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daryl Stultz <da...@6degrees.com>
Subject Re: PC object losing state
Date Mon, 04 Jan 2010 19:29:02 GMT
On Mon, Jan 4, 2010 at 1:37 PM, Pinaki Poddar <ppoddar@apache.org> wrote:

>
> > is there any debugging code I could put in to reveal clues?
>
> I'm currently using this (which is not on production system yet):

OpenJPAEntityManager emo = (OpenJPAEntityManager) em;
sb.append("EM:");
sb.append(emo.isDetached(object) ? "D" : "d");
sb.append(emo.isDirty(object) ? "X" : "x");
sb.append(emo.isNewlyPersistent(object) ? "N" : "n");
sb.append(emo.isPersistent(object) ? "P" : "p");
sb.append(emo.isRemoved(object) ? "R" : "r");
sb.append(emo.isTransactional(object) ? "T" : "t");
EntityManagerImpl emi = (EntityManagerImpl) em;
final Broker broker = emi.getBroker();
sb.append(" BK:");
sb.append(broker.isDetachedNew() ? "C" : "c");
sb.append(broker.isDetached(object) ? "D" : "d");
sb.append(broker.isDirty(object) ? "X" : "x");
sb.append(broker.isNew(object) ? "N" : "n");
sb.append(broker.isPersistent(object) ? "P" : "p");
sb.append(broker.isDeleted(object) ? "R" : "r");
sb.append(broker.isTransactional(object) ? "T" : "t");
OpenJPAStateManager sm = broker.getStateManager(object);
sb.append(" SM:");
if (sm != null) {

sb.append(sm.isDetached() ? "D" : "d");
sb.append(sm.isDirty() ? "X" : "x");
sb.append(sm.isNew() ? "N" : "n");
sb.append(sm.isPersistent() ? "P" : "p");
sb.append(sm.isProvisional() ? "V" : "v");
sb.append(sm.isDeleted() ? "R" : "r");
sb.append(sm.isTransactional() ? "T" : "t");

} else {

sb.append("null");

}

I'm wondering if this code:

PersistenceCapable pc = ImplHelper.toPersistenceCapable(foo, null);
> print(pc + ".isDetached() = " + pc.pcIsDetached());
> print(pc + ".getDetachedState() = " +
> Arrays.toString((Object[])pc.pcGetDetachedState());
>
>
> adds anything to my code. Probably the last line...

-- 
Daryl Stultz
_____________________________________
6 Degrees Software and Consulting, Inc.
http://www.6degrees.com
mailto:daryl@6degrees.com

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message