Kuali Rice Development
  1. Kuali Rice Development
  2. KULRICE-2478

Ensure that Rice configuration of JPA is easy to understand and use

    Details

    • Type: Improvement Improvement
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Cannot Reproduce
    • Affects Version/s: None
    • Fix Version/s: Not version specific
    • Component/s: JPA
    • Labels:
      None
    • Similar issues:
      KULRICE-1419improve ability to report on, understand, maintain workflow configuration
      KULRICE-9739Improve ease of configuration of JPA for a module that is using KRAD
      KULRICE-9925Refactor EclipseLinkSequenceCustomizer so that works more like regular sequence configuration in JPA
      KULRICE-2058Ensure JPA can work with JOTM or Atomikos
      KULRICE-4220Ensure that Rice is using up-to-date referenced libraries
      KULRICE-3808JPA - Ensure and test that Criteria.java that's being used for Document Search is working properly
      KULRICE-6014JPA Conversion Guide
      KULRICE-2732Rice configuration enhancements to support standalone use
      KULRICE-210Build a "rice client project template" for easy Rice client development
      KULRICE-6436Tune ehcache configuration for the various rice modules

      Description

      Look at general configuration for how to switch between ojb and jpa
      in rice. Improve if needed. Also, make sure that defaulting of
      configuration is in place for configuring the various entity manager factories.

      Most of the related code here is in RiceLocalContainerEntityManagerFactoryBean.

      Also, we currently have a flag to turn off JPA for applications that don't want to use it. This prevents it from loading up the JPA mappings and ensures the dao proxies always return the ojb equivalent. We may want a similar configuration parameter to turn off OJB which would prevent it from even loading the OJB mappings into the MetadataManager (this would help with startup time when not using OJB).

        Activity

        Hide
        Garey Taylor added a comment - - edited

        The configuration is spread over a couple files.

        If you want to turn on JPA for the system, you can set:
        rice.jpa.enabled=true
        but I wouldn't recommend this at the moment.

        Rice has the ability to turn on jpa by module and this is the approach I would take.

        so, if you just want to jpa enable ksb, you would use:
        rice.ksb.jpa.enable=true

        This might* work for all modules but I'm not 100% sure. I know it works for kew and ksb.

        Example configs needed to get jpa working for ksb:
        --------------------------------------------------------------------------
        <!-- Start JPA Oracle Config -->
        <param name="rice.jpa.JpaProperties.hibernate.hbm2ddl.auto">validate</param>
        <param name="rice.jpa.DatabasePlatform">org.hibernate.dialect.OracleDialect</param>
        <param name="rice.jpa.UseSerialization">false</param>

        <!-- JPA Config for KSB -->
        <param name="rice.ksb.jpa.enabled">true</param>
        <param name="rice.ksb.registry.jpa.PersistenceXmlLocation">META-INF/ksb-persistence.xml</param>
        <param name="rice.ksb.registry.jpa.PersistenceUnitName">ksb-sequence-registry-unit</param>
        <param name="rice.ksb.registry.jpa.GenerateDdl">true</param> <!-- Optional -->

        <param name="rice.ksb.message.jpa.PersistenceXmlLocation">META-INF/ksb-persistence.xml</param>
        <param name="rice.ksb.message.jpa.PersistenceUnitName">ksb-sequence-message-unit</param>
        <param name="rice.ksb.message.jpa.GenerateDdl">true</param> <!-- Optional -->
        <!-- End JPA Oracle Config -->
        --------------------------------------------------------------------------------------------

        Some files to look at:
        KEW and KSB have different way of configuring it's obj vs jpa beans.

        In the kew and ksb configurer classes (KEWConfigurer.java, KSBConfigurer.java)
        look in getEmbeddedSpringFileLocation()
        you will notice that it checks for the jpa enabled and then will look at one of two hard coded file locations (for KEWConfigurer):
        KEWJPASpringBeans.xml
        KEWOJBSpringBeans.xml

        these files contain the bean definitions for both jpa and ojb. Only one will be loaded depending on jpa enabled. Also note that the bean names are the same, but the implementations are different.

        In all other modules besides kew and ksb there is only one spring configuration for jpa and ojb. So both sets of beans can get generated, which is inefficient.
        To see an example of this look at KNSSpringBeans.xml
        <bean id="persistenceDao" class="org.kuali.rice.kns.dao.proxy.PersistenceDaoProxy">
        <property name="persistenceDaoJpa" ref="persistenceDaoJpa" />
        <property name="persistenceDaoOjb" ref="persistenceDaoOjb" />
        </bean>

        this does a check between the two and returns jpa or ojb depending on the rice.jpa.enabled

        Show
        Garey Taylor added a comment - - edited The configuration is spread over a couple files. If you want to turn on JPA for the system, you can set: rice.jpa.enabled=true but I wouldn't recommend this at the moment. Rice has the ability to turn on jpa by module and this is the approach I would take. so, if you just want to jpa enable ksb, you would use: rice.ksb.jpa.enable=true This might* work for all modules but I'm not 100% sure. I know it works for kew and ksb. Example configs needed to get jpa working for ksb: -------------------------------------------------------------------------- <!-- Start JPA Oracle Config --> <param name="rice.jpa.JpaProperties.hibernate.hbm2ddl.auto">validate</param> <param name="rice.jpa.DatabasePlatform">org.hibernate.dialect.OracleDialect</param> <param name="rice.jpa.UseSerialization">false</param> <!-- JPA Config for KSB --> <param name="rice.ksb.jpa.enabled">true</param> <param name="rice.ksb.registry.jpa.PersistenceXmlLocation">META-INF/ksb-persistence.xml</param> <param name="rice.ksb.registry.jpa.PersistenceUnitName">ksb-sequence-registry-unit</param> <param name="rice.ksb.registry.jpa.GenerateDdl">true</param> <!-- Optional --> <param name="rice.ksb.message.jpa.PersistenceXmlLocation">META-INF/ksb-persistence.xml</param> <param name="rice.ksb.message.jpa.PersistenceUnitName">ksb-sequence-message-unit</param> <param name="rice.ksb.message.jpa.GenerateDdl">true</param> <!-- Optional --> <!-- End JPA Oracle Config --> -------------------------------------------------------------------------------------------- Some files to look at: KEW and KSB have different way of configuring it's obj vs jpa beans. In the kew and ksb configurer classes (KEWConfigurer.java, KSBConfigurer.java) look in getEmbeddedSpringFileLocation() you will notice that it checks for the jpa enabled and then will look at one of two hard coded file locations (for KEWConfigurer): KEWJPASpringBeans.xml KEWOJBSpringBeans.xml these files contain the bean definitions for both jpa and ojb. Only one will be loaded depending on jpa enabled. Also note that the bean names are the same, but the implementations are different. In all other modules besides kew and ksb there is only one spring configuration for jpa and ojb. So both sets of beans can get generated, which is inefficient. To see an example of this look at KNSSpringBeans.xml <bean id="persistenceDao" class="org.kuali.rice.kns.dao.proxy.PersistenceDaoProxy"> <property name="persistenceDaoJpa" ref="persistenceDaoJpa" /> <property name="persistenceDaoOjb" ref="persistenceDaoOjb" /> </bean> this does a check between the two and returns jpa or ojb depending on the rice.jpa.enabled
        Hide
        Garey Taylor added a comment -

        One possible enhancement would be to add the default persistence xml files into our common-config-default.xml file.

        So, we would add:
        <param name="rice.ksb.registry.jpa.PersistenceXmlLocation">META-INF/ksb-persistence.xml</param>
        <param name="rice.ksb.registry.jpa.PersistenceUnitName">ksb-registry-identity-unit</param>
        <param name="rice.ksb.message.jpa.PersistenceXmlLocation">META-INF/ksb-persistence.xml</param>
        <param name="rice.ksb.message.jpa.PersistenceUnitName">ksb-message-identity-unit</param>

        These are already defaults in our system, so why not add them to common config so we don't have to declare them.

        Show
        Garey Taylor added a comment - One possible enhancement would be to add the default persistence xml files into our common-config-default.xml file. So, we would add: <param name="rice.ksb.registry.jpa.PersistenceXmlLocation">META-INF/ksb-persistence.xml</param> <param name="rice.ksb.registry.jpa.PersistenceUnitName">ksb-registry-identity-unit</param> <param name="rice.ksb.message.jpa.PersistenceXmlLocation">META-INF/ksb-persistence.xml</param> <param name="rice.ksb.message.jpa.PersistenceUnitName">ksb-message-identity-unit</param> These are already defaults in our system, so why not add them to common config so we don't have to declare them.
        Hide
        Chad Hagstrom added a comment -

        Here's what I'm currently using:

        <!-- JPA-related parameters -->
        <param name="rice.jpa.DatabasePlatform" override="false">org.hibernate.dialect.OracleDialect</param>
        <param name="rice.jpa.UseSerialization" override="false">false</param>
        <!-- End JPA-related parameters -->

        <!-- KSB-specific JPA parameters -->
        <param name="rice.ksb.jpa.enabled" override="false">true</param>
        <param name="rice.ksb.registry.jpa.PersistenceXmlLocation" override="false">META-INF/ksb-persistence.xml</param>
        <param name="rice.ksb.registry.jpa.PersistenceUnitName" override="false">ksb-registry-unit</param>
        <param name="rice.ksb.registry.jpa.GenerateDdl" override="false">true</param>
        <param name="rice.ksb.message.jpa.PersistenceXmlLocation" override="false">META-INF/ksb-persistence.xml</param>
        <param name="rice.ksb.message.jpa.PersistenceUnitName" override="false">ksb-message-unit</param>
        <param name="rice.ksb.message.jpa.GenerateDdl" override="false">true</param>
        <!-- End KSB-specific JPA parameters -->

        Show
        Chad Hagstrom added a comment - Here's what I'm currently using: <!-- JPA-related parameters --> <param name="rice.jpa.DatabasePlatform" override="false">org.hibernate.dialect.OracleDialect</param> <param name="rice.jpa.UseSerialization" override="false">false</param> <!-- End JPA-related parameters --> <!-- KSB-specific JPA parameters --> <param name="rice.ksb.jpa.enabled" override="false">true</param> <param name="rice.ksb.registry.jpa.PersistenceXmlLocation" override="false">META-INF/ksb-persistence.xml</param> <param name="rice.ksb.registry.jpa.PersistenceUnitName" override="false">ksb-registry-unit</param> <param name="rice.ksb.registry.jpa.GenerateDdl" override="false">true</param> <param name="rice.ksb.message.jpa.PersistenceXmlLocation" override="false">META-INF/ksb-persistence.xml</param> <param name="rice.ksb.message.jpa.PersistenceUnitName" override="false">ksb-message-unit</param> <param name="rice.ksb.message.jpa.GenerateDdl" override="false">true</param> <!-- End KSB-specific JPA parameters -->
        Hide
        Jessica Coltrin (Inactive) added a comment -

        still relevant, but not blockers - downgrading to Major

        Show
        Jessica Coltrin (Inactive) added a comment - still relevant, but not blockers - downgrading to Major
        Hide
        Jessica Coltrin (Inactive) added a comment -

        later phase of JPA conversion is complete. Closing JIRAs from earlier attempts.

        Show
        Jessica Coltrin (Inactive) added a comment - later phase of JPA conversion is complete. Closing JIRAs from earlier attempts.

          People

          • Assignee:
            Unassigned
            Reporter:
            Eric Westfall
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Structure Helper Panel