Class Panache


  • public class Panache
    extends Object
    Utility class for Panache.
    Author:
    Stéphane Épardaud
    • Constructor Detail

      • Panache

        public Panache()
    • Method Detail

      • getSession

        public static org.hibernate.reactive.mutiny.Mutiny.Session getSession()
        Returns the current Mutiny.Session
        Returns:
        the current Mutiny.Session
      • withTransaction

        public static <T> io.smallrye.mutiny.Uni<T> withTransaction​(Supplier<io.smallrye.mutiny.Uni<T>> work)
        Performs the given work within the scope of a database transaction, automatically flushing the session. The transaction will be rolled back if the work completes with an uncaught exception, or if Mutiny.Transaction.markForRollback() is called.
        Type Parameters:
        T - The function's return type
        Parameters:
        work - The function to execute in the new transaction
        Returns:
        the result of executing the function
      • executeUpdate

        public static io.smallrye.mutiny.Uni<Integer> executeUpdate​(String query,
                                                                    Object... params)
        Executes a database update operation and return the number of rows operated on.
        Parameters:
        query - a normal HQL query
        params - optional list of indexed parameters
        Returns:
        the number of rows operated on.
      • executeUpdate

        public static io.smallrye.mutiny.Uni<Integer> executeUpdate​(String query,
                                                                    Map<String,​Object> params)
        Executes a database update operation and return the number of rows operated on.
        Parameters:
        query - a normal HQL query
        params - Map of named parameters
        Returns:
        the number of rows operated on.
      • executeUpdate

        public static io.smallrye.mutiny.Uni<Integer> executeUpdate​(String query,
                                                                    io.quarkus.panache.common.Parameters params)
        Executes a database update operation and return the number of rows operated on.
        Parameters:
        query - a normal HQL query
        params - Parameters of named parameters
        Returns:
        the number of rows operated on.
      • flush

        public static io.smallrye.mutiny.Uni<Void> flush()
        Flush all pending changes to the database.
        Returns:
        void