Class JpaMapUtils

java.lang.Object
org.keycloak.models.map.storage.jpa.JpaMapUtils

public class JpaMapUtils extends Object
Author:
Marek Posolda
  • Field Details

  • Constructor Details

    • JpaMapUtils

      public JpaMapUtils()
  • Method Details

    • getSchemaForNativeQuery

      public static String getSchemaForNativeQuery(jakarta.persistence.EntityManager em)
    • loadSpecificNamedQueries

      public static Properties loadSpecificNamedQueries(String databaseType)
      Method that adds the different query variants for the database. The method loads the queries specified in the files META-INF/jpa-map/queries-{dbType}.properties and the default META-INF/jpa-map/queries-default.properties. At least the default file should exist inside the jar file. The default file contains all the needed queries and the specific one can overload all or some of them for that database type.
      Parameters:
      databaseType - The database type as returned by getDatabaseType
    • loadSqlProperties

      public static Properties loadSqlProperties(URL url)
      Loads the URL as a properties file.
      Parameters:
      url - The url to load, it can be null
      Returns:
      A properties file with the url loaded or null
    • configureNamedQuery

      public static void configureNamedQuery(String queryName, String querySql, jakarta.persistence.EntityManager entityManager)
      Configures a named query to Hibernate.
      Parameters:
      queryName - the query name
      querySql - the query SQL
      entityManager - the entity manager
    • getDatabaseType

      public static String getDatabaseType(String productName)
    • addSpecificNamedQueries

      public static void addSpecificNamedQueries(jakarta.persistence.EntityManagerFactory emf)