java.lang.Object
io.quarkiverse.groovy.hibernate.reactive.panache.Panache

public class Panache extends Object
Utility class for Panache.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static io.smallrye.mutiny.Uni<org.hibernate.reactive.mutiny.Mutiny.Transaction>
    Returns the current transaction, if any, or null.
    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.
    static io.smallrye.mutiny.Uni<Integer>
    executeUpdate(String query, Object... params)
    Executes a database update operation and return the number of rows operated on.
    static io.smallrye.mutiny.Uni<Integer>
    Executes a database update operation and return the number of rows operated on.
    static io.smallrye.mutiny.Uni<Void>
    Flush all pending changes to the database.
    static io.smallrye.mutiny.Uni<org.hibernate.reactive.mutiny.Mutiny.Session>
    Returns the current Mutiny.Session
    static <T> io.smallrye.mutiny.Uni<T>
    withSession(Supplier<io.smallrye.mutiny.Uni<T>> uniSupplier)
    Obtains a Uni within the scope of a reactive session.
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Panache

      public Panache()
  • Method Details

    • withSession

      public static <T> io.smallrye.mutiny.Uni<T> withSession(Supplier<io.smallrye.mutiny.Uni<T>> uniSupplier)
      Obtains a Uni within the scope of a reactive session. If a reactive session exists then it is reused. If it does not exist then open a new session that is automatically closed when the provided Uni completes.
      Returns:
      a new Uni
    • getSession

      public static io.smallrye.mutiny.Uni<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
      See Also:
    • 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
    • currentTransaction

      public static io.smallrye.mutiny.Uni<org.hibernate.reactive.mutiny.Mutiny.Transaction> currentTransaction()
      Returns the current transaction, if any, or null.
      Returns:
      the current transaction, if any, or null.
      See Also: