org.wamblee.persistence
Class PersistentFactory

java.lang.Object
  extended by org.wamblee.persistence.PersistentFactory

public class PersistentFactory
extends Object

Factory which creates a Persistent object for a given JPA entity for interfacing with the primary key and version of the entity. This utility only treats primary keys and fields that are annotated with @Id and @Version. In case ORM files are used for the definition of primary key and or version, then those fields are ignored.

Author:
Erik Brakkee

Nested Class Summary
static class PersistentFactory.EntityObjectAccessor
           
 
Constructor Summary
PersistentFactory()
           
 
Method Summary
static Persistent create(Object aEntity)
          Creates the Persistent wrapper for interfacing with primary key and version of the entity.
static org.wamblee.persistence.PersistentFactory.EntityAccessor createEntityAccessor(Class aClass)
          Create the entity accessor for a given class or returns a cached instance if one already exists.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PersistentFactory

public PersistentFactory()
Method Detail

createEntityAccessor

public static org.wamblee.persistence.PersistentFactory.EntityAccessor createEntityAccessor(Class aClass)
Create the entity accessor for a given class or returns a cached instance if one already exists.

Parameters:
aClass - Class.
Returns:
Entity accessor for the given class or null of the given object is not an entity.

create

public static Persistent create(Object aEntity)
Creates the Persistent wrapper for interfacing with primary key and version of the entity.

Parameters:
aEntity - Entity to use.
Returns:
Persistent object or null if this is not an entity.


Copyright © 2011. All Rights Reserved.