Class HibernateController

java.lang.Object
io.micronaut.controlpanel.panels.hibernate.HibernateController

@Controller("${micronaut.control-panel.path:/control-panel}/hibernate-control-panel-controller") @ExecuteOn("blocking") @Internal public final class HibernateController extends Object
REST controller for Hibernate runtime operations in the Micronaut Control Panel.
Since:
2.0.0
Author:
Denis Stepanov
  • Constructor Details

    • HibernateController

      public HibernateController(io.micronaut.context.BeanLocator locator)
      Constructor.
      Parameters:
      locator - the bean locator
  • Method Details

    • setStatisticsEnabled

      @Post("/{sessionFactory}/statistics/enabled/{enabled}") public io.micronaut.http.HttpResponse<Void> setStatisticsEnabled(String sessionFactory, boolean enabled)
      Enables or disables Hibernate statistics for a session factory.
      Parameters:
      sessionFactory - the session factory bean name
      enabled - whether statistics should be enabled
      Returns:
      HTTP 204 if the operation was performed
    • executeHql

      @Post(value="/{sessionFactory}/hql", produces="application/json") public io.micronaut.http.HttpResponse<Map<String,Object>> executeHql(String sessionFactory, @Body HibernateController.HqlQueryRequest request)
      Executes a read-only HQL query for a session factory.
      Parameters:
      sessionFactory - the session factory bean name
      request - the HQL query request
      Returns:
      paged query results
    • clearStatistics

      @Delete("/{sessionFactory}/statistics") public io.micronaut.http.HttpResponse<Void> clearStatistics(String sessionFactory)
      Clears Hibernate statistics for a session factory.
      Parameters:
      sessionFactory - the session factory bean name
      Returns:
      HTTP 204 if the operation was performed
    • evictAllCacheRegions

      @Delete("/{sessionFactory}/cache") public io.micronaut.http.HttpResponse<Void> evictAllCacheRegions(String sessionFactory)
      Evicts every Hibernate cache region for a session factory.
      Parameters:
      sessionFactory - the session factory bean name
      Returns:
      HTTP 204 if the operation was performed
    • evictCacheRegion

      @Delete("/{sessionFactory}/cache/region") public io.micronaut.http.HttpResponse<Void> evictCacheRegion(String sessionFactory, @QueryValue String region)
      Evicts one Hibernate cache region.
      Parameters:
      sessionFactory - the session factory bean name
      region - the cache region name
      Returns:
      HTTP 204 if the operation was performed
    • evictEntityData

      @Delete("/{sessionFactory}/cache/entity") public io.micronaut.http.HttpResponse<Void> evictEntityData(String sessionFactory, @QueryValue String entity)
      Evicts cached data for one entity.
      Parameters:
      sessionFactory - the session factory bean name
      entity - the Hibernate entity name
      Returns:
      HTTP 204 if the operation was performed
    • evictCollectionData

      @Delete("/{sessionFactory}/cache/collection") public io.micronaut.http.HttpResponse<Void> evictCollectionData(String sessionFactory, @QueryValue String role)
      Evicts cached data for one collection role.
      Parameters:
      sessionFactory - the session factory bean name
      role - the Hibernate collection role
      Returns:
      HTTP 204 if the operation was performed
    • evictDefaultQueryRegion

      @Delete("/{sessionFactory}/cache/default-query-region") public io.micronaut.http.HttpResponse<Void> evictDefaultQueryRegion(String sessionFactory)
      Evicts Hibernate's default query cache region.
      Parameters:
      sessionFactory - the session factory bean name
      Returns:
      HTTP 204 if the operation was performed
    • evictQueryRegion

      @Delete("/{sessionFactory}/cache/query-region") public io.micronaut.http.HttpResponse<Void> evictQueryRegion(String sessionFactory, @QueryValue String region)
      Evicts one Hibernate query cache region.
      Parameters:
      sessionFactory - the session factory bean name
      region - the query cache region name
      Returns:
      HTTP 204 if the operation was performed
    • evictQueryRegions

      @Delete("/{sessionFactory}/cache/query-regions") public io.micronaut.http.HttpResponse<Void> evictQueryRegions(String sessionFactory)
      Evicts all Hibernate query cache regions.
      Parameters:
      sessionFactory - the session factory bean name
      Returns:
      HTTP 204 if the operation was performed