Class JpaBeans

java.lang.Object
org.apereo.cas.configuration.support.JpaBeans

public class JpaBeans extends Object
This is JpaBeans.
Since:
5.2.0
  • Constructor Details

    • JpaBeans

      public JpaBeans()
  • Method Details

    • newDataSource

      public DataSource newDataSource(String driverClass, String username, String password, String url)
      New simple data source.
      Parameters:
      driverClass - the driver class
      username - the username
      password - the password
      url - the url
      Returns:
      the data source
    • newDataSource

      public 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/env in dataSourceName and put resource reference in web.xml otherwise dataSourceName is used as JNDI name.

      Parameters:
      jpaProperties - the jpa properties
      Returns:
      the data source
    • newEntityManagerFactoryBean

      public 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 boolean isValidDataSourceConnection(CloseableDataSource ds, int timeout)
      Is valid data source connection.
      Parameters:
      ds - the ds
      timeout - the timeout
      Returns:
      true/false