Class JpaBeans
- java.lang.Object
-
- org.apereo.cas.configuration.support.JpaBeans
-
public class JpaBeans extends java.lang.ObjectThis isJpaBeans.- Since:
- 5.2.0
-
-
Constructor Summary
Constructors Constructor Description JpaBeans()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleanisValidDataSourceConnection(CloseableDataSource ds, int timeout)Is valid data source connection.static javax.sql.DataSourcenewDataSource(java.lang.String driverClass, java.lang.String username, java.lang.String password, java.lang.String url)New simple data source.static CloseableDataSourcenewDataSource(org.apereo.cas.configuration.model.support.jpa.AbstractJpaProperties jpaProperties)Get new data source, from JNDI lookup or created via direct configuration of Hikari pool.static org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBeannewEntityManagerFactoryBean(org.apereo.cas.configuration.model.support.jpa.JpaConfigurationContext config)New entity manager factory bean.
-
-
-
Method Detail
-
newDataSource
public static javax.sql.DataSource newDataSource(java.lang.String driverClass, java.lang.String username, java.lang.String password, java.lang.String url)New simple data source.- Parameters:
driverClass- the driver classusername- the usernamepassword- the passwordurl- the url- Returns:
- the data source
-
newDataSource
public static CloseableDataSource newDataSource(org.apereo.cas.configuration.model.support.jpa.AbstractJpaProperties jpaProperties)
Get new data source, from JNDI lookup or created via direct configuration of Hikari pool.If properties specify a data source name, a lookup will be attempted. If the DataSource is not found via JNDI then CAS will attempt to configure a Hikari connection pool.
Since the datasource beans are
RefreshScope, they will be a proxied by Spring and on some application servers there have been classloading issues. A workaround for this is to use activate data source proxying via settings and then the dataSource will be wrapped in an application level class. If that is an issue, don't do it.If user wants to do lookup as resource, they may include
java:/comp/envindataSourceNameand put resource reference in web.xml otherwisedataSourceNameis used as JNDI name.- Parameters:
jpaProperties- the jpa properties- Returns:
- the data source
-
newEntityManagerFactoryBean
public static org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean newEntityManagerFactoryBean(org.apereo.cas.configuration.model.support.jpa.JpaConfigurationContext config)
New entity manager factory bean.- Parameters:
config- the config- Returns:
- the local container entity manager factory bean
-
isValidDataSourceConnection
public static boolean isValidDataSourceConnection(CloseableDataSource ds, int timeout)
Is valid data source connection.- Parameters:
ds- the dstimeout- the timeout- Returns:
- the boolean
-
-