Class JpaMapUtils
- java.lang.Object
-
- org.keycloak.models.map.storage.jpa.JpaMapUtils
-
public class JpaMapUtils extends Object
- Author:
- Marek Posolda
-
-
Field Summary
Fields Modifier and Type Field Description static StringQUERY_JPQL_SUFFIXstatic StringQUERY_NATIVE_SUFFIX
-
Constructor Summary
Constructors Constructor Description JpaMapUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidaddSpecificNamedQueries(javax.persistence.EntityManagerFactory emf)static voidconfigureNamedQuery(String queryName, String querySql, javax.persistence.EntityManager entityManager)Configures a named query to Hibernate.static StringgetDatabaseType(String productName)static StringgetSchemaForNativeQuery(javax.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 Detail
-
QUERY_NATIVE_SUFFIX
public static final String QUERY_NATIVE_SUFFIX
- See Also:
- Constant Field Values
-
QUERY_JPQL_SUFFIX
public static final String QUERY_JPQL_SUFFIX
- See Also:
- Constant Field Values
-
-
Method Detail
-
getSchemaForNativeQuery
public static String getSchemaForNativeQuery(javax.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 bygetDatabaseType
-
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, javax.persistence.EntityManager entityManager)
Configures a named query to Hibernate.- Parameters:
queryName- the query namequerySql- the query SQLentityManager- the entity manager
-
addSpecificNamedQueries
public static void addSpecificNamedQueries(javax.persistence.EntityManagerFactory emf)
-
-