org.tynamo.jdo.internal
Class EntityPersistentFieldStrategy

java.lang.Object
  extended by org.apache.tapestry5.internal.services.AbstractSessionPersistentFieldStrategy
      extended by org.tynamo.jdo.internal.EntityPersistentFieldStrategy
All Implemented Interfaces:
org.apache.tapestry5.services.PersistentFieldStrategy

public class EntityPersistentFieldStrategy
extends org.apache.tapestry5.internal.services.AbstractSessionPersistentFieldStrategy

Persists JDO entities by storing their object ID in the session.

By definition, the object ID of a JDO object is serializable; thus, there is no problem with using the actual object for persisting it in the session (that is roughly the reason why JDO requires the object ID to be serializable in the first place).

See Also:
PersistedEntity

Constructor Summary
EntityPersistentFieldStrategy(javax.jdo.PersistenceManager pm, org.apache.tapestry5.services.Request request)
           
 
Method Summary
protected  Object convertApplicationValueToPersisted(Object persistentObject)
          Converts the persistent entity into a serializable object that can be safely stored into the session.
protected  Object convertPersistedToApplicationValue(Object persistedValue)
          Converts the persisted value from the session into a full blown persistent JDO object.
 
Methods inherited from class org.apache.tapestry5.internal.services.AbstractSessionPersistentFieldStrategy
didReadChange, discardChanges, gatherFieldChanges, postChange
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EntityPersistentFieldStrategy

public EntityPersistentFieldStrategy(javax.jdo.PersistenceManager pm,
                                     org.apache.tapestry5.services.Request request)
Method Detail

convertApplicationValueToPersisted

protected Object convertApplicationValueToPersisted(Object persistentObject)
Converts the persistent entity into a serializable object that can be safely stored into the session.

Technically, the PersistedEntity is unnecessary as the JDO object ID already represents the class and the id value (thus, it's redundant to create the PersistedEntity

Overrides:
convertApplicationValueToPersisted in class org.apache.tapestry5.internal.services.AbstractSessionPersistentFieldStrategy
Parameters:
persistentObject - the JDO object to be persisted in the session
Returns:
a representation of the persisted entity

convertPersistedToApplicationValue

protected Object convertPersistedToApplicationValue(Object persistedValue)
Converts the persisted value from the session into a full blown persistent JDO object.

Overrides:
convertPersistedToApplicationValue in class org.apache.tapestry5.internal.services.AbstractSessionPersistentFieldStrategy
Parameters:
persistedValue - the value representing the persistent object.
Returns:
a persistent entity retrieved from JDO


Copyright © 2011-2012. All Rights Reserved.