Class JpaMapUtils
java.lang.Object
org.keycloak.models.map.storage.jpa.JpaMapUtils
- Author:
- Marek Posolda
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddSpecificNamedQueries(jakarta.persistence.EntityManagerFactory emf) static voidconfigureNamedQuery(String queryName, String querySql, jakarta.persistence.EntityManager entityManager) Configures a named query to Hibernate.static StringgetDatabaseType(String productName) static StringgetSchemaForNativeQuery(jakarta.persistence.EntityManager em) static PropertiesloadSpecificNamedQueries(String databaseType) Method that adds the different query variants for the database.static PropertiesloadSqlProperties(URL url) Loads the URL as a properties file.
-
Field Details
-
QUERY_NATIVE_SUFFIX
- See Also:
-
QUERY_JPQL_SUFFIX
- See Also:
-
-
Constructor Details
-
JpaMapUtils
public JpaMapUtils()
-
-
Method Details
-
getSchemaForNativeQuery
-
loadSpecificNamedQueries
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 bygetDatabaseType
-
loadSqlProperties
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 namequerySql- the query SQLentityManager- the entity manager
-
getDatabaseType
-
addSpecificNamedQueries
public static void addSpecificNamedQueries(jakarta.persistence.EntityManagerFactory emf)
-