Package io.quarkus.hibernate.orm.panache
Class Panache
java.lang.Object
io.quarkus.hibernate.orm.panache.Panache
Utility class for Panache.
- Author:
- Stéphane Épardaud
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intexecuteUpdate(String query, Parameters params) Executes a database update operation and return the number of rows operated on.static intexecuteUpdate(String query, Object... params) Executes a database update operation and return the number of rows operated on.static intexecuteUpdate(String query, Map<String, Object> params) Executes a database update operation and return the number of rows operated on.static voidflush()Flushes all pending changes to the database using the default entity manager.static voidFlushes all pending changes to the database using the entity manager for the givenentitystatic voidFlushes all pending changes to the database using the entity manager for the given persistence unitstatic jakarta.persistence.EntityManagerReturns the defaultEntityManagerstatic jakarta.persistence.EntityManagergetEntityManager(Class<?> clazz) Returns theEntityManagerfor the givenentitystatic jakarta.persistence.EntityManagergetEntityManager(String persistenceUnit) Returns theEntityManagerfor the given persistence unitstatic org.hibernate.SessionReturns the defaultSessionstatic org.hibernate.SessiongetSession(Class<?> clazz) Returns theSessionfor the givenentitystatic org.hibernate.SessiongetSession(String persistenceUnit) Returns theSessionfor the given persistence unitstatic jakarta.transaction.TransactionManagerReturns the currentTransactionManagerstatic voidMarks the current transaction as "rollback-only", which means that it will not be committed: it will be rolled back at the end of this transaction lifecycle.
-
Constructor Details
-
Panache
public Panache()
-
-
Method Details
-
getEntityManager
public static jakarta.persistence.EntityManager getEntityManager()Returns the defaultEntityManager- Returns:
EntityManager
-
getSession
public static org.hibernate.Session getSession()Returns the defaultSession- Returns:
Session
-
getEntityManager
Returns theEntityManagerfor the givenentity- Parameters:
clazz- the entity class corresponding to the entity manager persistence unit.- Returns:
EntityManager
-
getSession
Returns theSessionfor the givenentity- Parameters:
clazz- the entity class corresponding to the session persistence unit.- Returns:
Session
-
getEntityManager
Returns theEntityManagerfor the given persistence unit- Parameters:
persistenceUnit- the persistence unit for this entity manager.- Returns:
EntityManager
-
getSession
Returns theSessionfor the given persistence unit- Parameters:
persistenceUnit- the persistence unit for this session.- Returns:
Session
-
getTransactionManager
public static jakarta.transaction.TransactionManager getTransactionManager()Returns the currentTransactionManager- Returns:
- the current
TransactionManager
-
executeUpdate
Executes a database update operation and return the number of rows operated on.- Parameters:
query- a normal HQL queryparams- optional list of indexed parameters- Returns:
- the number of rows operated on.
-
executeUpdate
Executes a database update operation and return the number of rows operated on.- Parameters:
query- a normal HQL queryparams-Mapof named parameters- Returns:
- the number of rows operated on.
-
executeUpdate
Executes a database update operation and return the number of rows operated on.- Parameters:
query- a normal HQL queryparams-Parametersof named parameters- Returns:
- the number of rows operated on.
-
setRollbackOnly
public static void setRollbackOnly()Marks the current transaction as "rollback-only", which means that it will not be committed: it will be rolled back at the end of this transaction lifecycle. -
flush
public static void flush()Flushes all pending changes to the database using the default entity manager. -
flush
Flushes all pending changes to the database using the entity manager for the givenentity- Parameters:
clazz- the entity class corresponding to the entity manager persistence unit.
-
flush
Flushes all pending changes to the database using the entity manager for the given persistence unit- Parameters:
persistenceUnit- the persistence unit for this entity manager.
-