Hibernate5与自定义事务协调器生成器

时间:2018-11-28 10:54:22

标签: hibernate spring-data-jpa hibernate-mapping

在使用带有自定义事务协调器构建器的spring xml配置解决hibernate 5配置时,我需要帮助。

XML configuration is as follows:

    <bean id="upsSessionFactory"
            class="org.springframework.orm.hibernate5.LocalSessionFactoryBean">
            <property name="dataSource" ref="upsDataSource" />
            <property name="mappingLocations">
                <list>
                    <value>classpath*:hbm/*.xml</value>
                </list>
            </property>
            <property name="hibernateProperties">
                <bean
                    class="org.springframework.beans.factory.config.PropertiesFactoryBean">
                    <property name="location" value="classpath:hibernate.properties" />
                    <property name="localOverride" value="true" />
                    <property name="properties">
                        <props>

                        <!--    <prop key="hibernate.transaction.factory_class">com.companyName.moduleName.hibernate.UpsTransactionFactory
                            </prop>-->
                            <prop key="hibernate.transaction.coordinator_class">com.companyanme.modulename.hibernate.UpsTransactionCoordinatorBuilder
                            </prop>


                            <prop key="hibernate.cache.region.factory_class">org.hibernate.cache.ehcache.SingletonEhCacheRegionFactory
                            </prop>


                            <prop key="hibernate.current_session_context_class">com.companyName.modulename.hibernate.Hib3CompatibleSpringSessionContext
                            </prop>
                        </props>
                    </property>
                </bean>
            </property>
        </bean>

注意:我通过引用UPsTransactionCoordinatorBuilderUPSTransactionCooridnator创建了两个自定义类(具有附加功能)JdbcResourceLocalTransactionCoordinatorBuilderImplJdbcCoordinatorImpl

我的问题是:如何集成Builder和Transaction Coordinator。在网络上找不到任何参考。

需要创建许多伴随对象,例如:TransactionCoordinatorOwnerOptionConnectionJdbcSessionOwner

任何人都可以帮助配置此自定义类并创建这些伴随对象吗?

0 个答案:

没有答案