Package de.xima.fc.jpa.context
Class EntityContextFactory
- java.lang.Object
-
- de.xima.fc.jpa.context.EntityContextFactory
-
public class EntityContextFactory extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static IEntityContextFactoryFACTORY
-
Constructor Summary
Constructors Constructor Description EntityContextFactory()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static IEntityContextjoinedSystemEntityContext(javax.persistence.EntityManager em)Creates an entity context for the system user over an entity manager that belongs to somebody else, so legacy DAOs can write into a transaction they did not open.static IEntityContextnewAnonymousEntityContext()static IEntityContextnewEntityContext()static IEntityContextnewEntityContext(Benutzer ben)Deprecated.UsenewEntityContext(IUser)instead.static IEntityContextnewEntityContext(IUser user)static IEntityContextnewEntityContext(UserContext uc)static IEntityContextnewSetupEntityContext()Deprecated.UsenewSystemEntityContext()instead.static IEntityContextnewSystemEntityContext()static IEntityContextreusedEntityContext(IEntityContext toReuse)Wraps anIEntityContextand prevents it from being closed.
-
-
-
Field Detail
-
FACTORY
public static IEntityContextFactory FACTORY
-
-
Method Detail
-
newEntityContext
public static IEntityContext newEntityContext()
-
newEntityContext
public static IEntityContext newEntityContext(UserContext uc)
-
newEntityContext
public static IEntityContext newEntityContext(IUser user)
-
newAnonymousEntityContext
public static IEntityContext newAnonymousEntityContext()
-
newSystemEntityContext
public static IEntityContext newSystemEntityContext()
-
joinedSystemEntityContext
public static IEntityContext joinedSystemEntityContext(javax.persistence.EntityManager em)
Creates an entity context for the system user over an entity manager that belongs to somebody else, so legacy DAOs can write into a transaction they did not open. The returned context never commits, rolls back or closes anything, that stays the business of whoever opened the transaction, and closing it does nothing.- Parameters:
em- The entity manager to join. Must be open.- Returns:
- An entity context over the given entity manager.
- Throws:
IllegalArgumentException- if the entity manager isnull.IllegalStateException- if the entity manager is closed.- Since:
- 8.5.6
-
newSetupEntityContext
@Deprecated public static IEntityContext newSetupEntityContext()
Deprecated.UsenewSystemEntityContext()instead.
-
newEntityContext
@Deprecated public static IEntityContext newEntityContext(Benutzer ben)
Deprecated.UsenewEntityContext(IUser)instead.
-
reusedEntityContext
public static IEntityContext reusedEntityContext(IEntityContext toReuse)
Wraps anIEntityContextand prevents it from being closed. Useful when you want to reuse another entity context, but still use the try-with-resources syntax.- Parameters:
toReuse- The entity context to reuse.- Returns:
- A wrapper that prevents the entity context from being closed.
- Since:
- 8.3.0
-
-