Uploaded image for project: 'PUBLIC - Liferay Portal Enterprise Edition'
  1. PUBLIC - Liferay Portal Enterprise Edition
  2. LPE-1491

Plugins can now dynamically modify portlet-hbm.xml

Details

    Description

      Service builder automatically generates portlet-hbm.xml. The generated models use a specific model implementation. Sometimes plugin developers will want to subclass those implementations and use a custom model implementations instead. If a developer modifies portlet-hbm.xml and points their models to the new implementation, they lose their modifications next time service builder generates portlet-hbm.xml. This improvement is designed to address this issue.

      To dynamically configure new classes, modify ext-spring.xml. For example:

      <?xml version="1.0" encoding="UTF-8"?>

      <beans
      xmlns="http://www.springframework.org/schema/beans"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"
      >
      <bean id="liferayHibernateSessionFactory" class="com.liferay.portal.spring.hibernate.PortletHibernateConfiguration">
      <property name="dataSource" ref="liferayDataSource" />
      <property name="hibernateConfigurationConverter" ref="liferayHibernateConfigurationConverter" />
      </bean>
      <bean id="liferayHibernateConfigurationConverter" class="com.liferay.portal.spring.hibernate.HibernateConfigurationConverter">
      <property name="classNames">
      <map key-type="java.lang.String" value-type="java.lang.String">
      <entry key="com.sample.model.FooImpl" value="com.sample.model.MyFooImpl" />
      </map>
      </property>
      </bean>
      </beans>

      This configuration will change com.sample.model.FooImpl in portlet-hbm.xml to com.sample.model.MyFooImpl.

      Suppose you want to do something even less predictable, simply set:

      <bean id="liferayHibernateConfigurationConverter" class="YOUROWNCLASSHERE">

      The liferayHibernateConfigurationConverter bean must implement com.liferay.portal.kernel.util.Converter<String>

      Attachments

        Issue Links

          Activity

            People

              michael.saechang Michael Saechang
              brian.chan Brian Chan
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Packages

                  Version Package
                  5.1 EE SP5 (5.1.8)
                  5.2 EE SP2 (5.2.6)