Package org.openxava.model
Class PersistenceFacade
java.lang.Object
org.openxava.model.PersistenceFacade
To access to some persistence services in an abstract way.
We need this class to write some code in OpenXava that works in the same way if we are using Hibernate or JPA (or other persistence technology).
This class can be used in custom application code, although for this case maybe it's better to use directly the JPA (or Hibernate) API.
This class uses the underlayer persistence provider associated to the corresponding entity.
If the methods fail they throw RuntimeException, the specific
RuntimeException depends on the implementation technology.
- Author:
- Javier Paniza
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringThe default schema for the underlying persistence engine in the current thread.static voidrefreshIfManaged(Object object) Refresh the state of the instance from the database, overwriting changes made to the entity, if any.static voidsetDefaultSchema(String defaultSchema) Changes the default schema for the underlying persistence engine in the current thread.
-
Constructor Details
-
PersistenceFacade
public PersistenceFacade()
-
-
Method Details
-
refreshIfManaged
Refresh the state of the instance from the database, overwriting changes made to the entity, if any.If the object is null or it's not managed simply do nothing, but not fails.
-
getDefaultSchema
The default schema for the underlying persistence engine in the current thread.- Since:
- 8.0
-
setDefaultSchema
Changes the default schema for the underlying persistence engine in the current thread.- Since:
- 8.0
-