Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
xml
xml
<dependency>
     <groupId>org.jasig.cas.server</groupId>
     <artifactId>cas-server-sessionstorage-jpa</artifactId>
     <version>${cas.version}</version>
     <scope>runtime</scope>
     <type>jar</type>
</dependency>

...

Code Block
xml
xml
<dependency>
     <groupId>org.jasig.cas.server</groupId>
     <artifactId>cas-server-sessionstorage-jpa</artifactId>
     <version>${cas.version}</version>
     <scope>runtime</scope>
     <type>jar</type>
     <exclusions>
          <exclusion>
               <groupId>org.hibernate</groupId>
               <artifactId>hibernate-entitymanager</artifactId>
          </exclusion>
          <exclusion>
               <groupId>c3p0</groupId>
               <artifactId>c3p0</artifactId>
          </exclusion>
     </exclusions>
</dependency>

...

Code Block
xml
xml
titleWEB-INF/spring/sessionStorage-jpa-configuration.xml
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:p="http://www.springframework.org/schema/p"
       xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
       xmlns:aop="http://www.springframework.org/schema/aop"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
       http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd 
       http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
       http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">

    <bean id="myEmf" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
        <property name="dataSource">
            <bean class="com.mchange.v2.c3p0.ComboPooledDataSource"
                  p:jdbcUrl="jdbc:mysql://localhost/cas"
                  p:user="root"
                  p:driverClass="com.mysql.jdbc.Driver">
            </bean>
        </property>
        <property name="jpaVendorAdapter">
            <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"
                p:generateDdl="true"
                p:showSql="true"/>
        </property>
        <property name="jpaPropertyMap">
            <map>
                <entry key="hibernate.dialect" value="org.hibernate.dialect.MySQL5Dialect"/>
                <entry key="hibernate.hbm2ddl.auto" value="update"/>
            </map>
        </property>
    </bean>

    <tx:advice id="txAdvice" transaction-manager="txManager">
        <tx:attributes>
            <tx:method name="*" no-rollback-for="org.jasig.cas.server.session.InvalidSessionException" isolation="DEFAULT" propagation="REQUIRED" />
        </tx:attributes>
    </tx:advice>

    <aop:config>
        <aop:pointcut id="centralAuthenticationServiceOperation" expression="execution(* org.jasig.cas.server.CentralAuthenticationService.*(..))"/>
        <aop:advisor advice-ref="txAdvice" pointcut-ref="centralAuthenticationServiceOperation"/>
    </aop:config>

    <bean id="txManager" class="org.springframework.orm.jpa.JpaTransactionManager">
        <property name="entityManagerFactory" ref="myEmf" />
    </bean>
</beans>

...