2012-12-16 10 views
6

एप्लिकेशन प्रबंधित इकाई प्रबंधकों का उपयोग करने के लिए मैं ग्लास मछली को कैसे कॉन्फ़िगर कर सकता हूं? मुझे नीचे दी गई कॉन्फ़िगरेशन के साथ निम्न त्रुटि मिलती है।एप्लिकेशन प्रबंधित इकाई प्रबंधकों का उपयोग करने के लिए मैं ग्लास मछली को कैसे कॉन्फ़िगर कर सकता हूं?

मैं लेनदेन का प्रबंधन करने के glassfish नहीं करना चाहती, मैं केवल RESOURCE_LOCAL की स्थापना, नहीं JTA साथ वसंत में कामयाब लेनदेन उपयोग करने के लिए, हठ इकाई में चाहते

SEVERE: Exception while preparing the app : The persistence-context-ref-name [org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean/entityManager] .... resolves to a persistence unit called [spring-jpa] which is of type RESOURCE_LOCAL. Only persistence units with transaction type JTA can be used as a container managed entity manager. Please verify your application. 

मेरे cofiguration:

<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"> 
    <persistence-unit name="spring-jpa" transaction-type="RESOURCE_LOCAL"> 
    <provider>org.hibernate.ejb.HibernatePersistence</provider> 
    <non-jta-data-source>mysql/mydb</non-jta-data-source> 
    <properties/> 
    </persistence-unit> 
</persistence> 

मेरे आवेदन संदर्भ:

<?xml version="1.0" encoding="UTF-8"?> 
<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:aop="http://www.springframework.org/schema/aop" 
     xmlns:tx="http://www.springframework.org/schema/tx" 
    xmlns:jpa="http://www.springframework.org/schema/data/jpa" 
    xmlns:context="http://www.springframework.org/schema/context" 
     xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd 
     http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd 
     http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd 
     http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd 
     http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa.xsd"> 

    <context:component-scan base-package="com.myproject"/> 
    <jpa:repositories base-package="com.myproject"/> 
    <tx:annotation-driven transaction-manager="transactionManager"/> 
    <bean id="dataSource" 
     //.... 
    </bean>  
    <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"> 
     <property name="dataSource" ref="dataSource"/> 
     <property name="persistenceUnitName" value="spring-jpa" /> 
     <property name="jpaVendorAdapter"> 
      <!-- <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">--> 
       <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"> 
       <property name="showSql" value="true" /> 
       <property name="generateDdl" value="true" /> 
       <property name="database" value="MYSQL" /> 
       <property name="databasePlatform" value="org.hibernate.dialect.MySQL5Dialect"/> 
      </bean> 
     </property> 
    </bean> 


<bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> 
    <property name="entityManagerFactory" ref="entityManagerFactory" /> 
</bean> 

</beans> 

उत्तर

2

मुझे this forum post मिला, मैंने उद्धरण दिया :

जावा ईई पर्यावरण में, यदि यह तत्व [लेनदेन-प्रकार] विशिष्ट नहीं है, तो डिफ़ॉल्ट जेटीए है। जावा एसई पर्यावरण में, यदि यह तत्व विशिष्ट नहीं है, तो RESOURCE_LOCAL का डिफ़ॉल्ट माना जा सकता है।

तो, आपके विन्यास की कोशिश में:

<persistence-unit name="spring-jpa" transaction-type="JTA"> 
संबंधित मुद्दे

 संबंधित मुद्दे