public class JPAPerister<T> extends AbstractPersister<T,Serializable> implements Persister<T>
Constructor and Description |
---|
JPAPerister(List<State<T>> states,
State<T> startState,
Class<T> clazz,
org.springframework.orm.jpa.EntityManagerFactoryInfo entityManagerFactory,
org.springframework.transaction.PlatformTransactionManager transactionManager) |
JPAPerister(List<State<T>> states,
String stateFieldName,
State<T> startState,
Class<T> clazz,
javax.persistence.EntityManager entityManager,
org.springframework.transaction.PlatformTransactionManager transactionManager) |
Modifier and Type | Method and Description |
---|---|
protected javax.persistence.Query |
buildUpdate(Object id,
T stateful,
State<T> current,
State<T> next,
Field idField,
Field stateField) |
protected Field |
findIdField(Class<?> clazz) |
javax.persistence.EntityManager |
getEntityManager() |
protected Class<?> |
getStateFieldType() |
void |
setCurrent(T stateful,
State<T> current,
State<T> next)
Set the current State.
|
void |
setEntityManager(javax.persistence.EntityManager entityManager) |
protected boolean |
validStateField(Field stateField) |
buildIdFieldAccessor, buildStateFieldAccessor, findStateField, getClazz, getCurrent, getId, getIdField, getIdFieldAccessor, getStartState, getState, getStateField, getStateFieldAccessor, setStartState, setState, setStates, throwStaleState
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getCurrent, setStartState, setStates
public JPAPerister(List<State<T>> states, State<T> startState, Class<T> clazz, org.springframework.orm.jpa.EntityManagerFactoryInfo entityManagerFactory, org.springframework.transaction.PlatformTransactionManager transactionManager)
public void setCurrent(T stateful, State<T> current, State<T> next) throws StaleStateException
setCurrent
in interface Persister<T>
setCurrent
in class AbstractPersister<T,Serializable>
stateful
- Stateful Entitycurrent
- Expected current Statenext
- The value of the next StateStaleStateException
- thrown if the value of the State does not equal to the provided current Statepublic javax.persistence.EntityManager getEntityManager()
public void setEntityManager(javax.persistence.EntityManager entityManager)
protected javax.persistence.Query buildUpdate(Object id, T stateful, State<T> current, State<T> next, Field idField, Field stateField) throws SecurityException, IllegalArgumentException, NoSuchFieldException, IllegalAccessException
protected boolean validStateField(Field stateField)
validStateField
in class AbstractPersister<T,Serializable>
protected Field findIdField(Class<?> clazz)
findIdField
in class AbstractPersister<T,Serializable>
protected Class<?> getStateFieldType()
getStateFieldType
in class AbstractPersister<T,Serializable>
Copyright © 2016. All rights reserved.