users@glassfish.java.net

Re: Persistence unit ref:

From: Winzinger, Ralph <ralph.winzinger_at_senacor.com>
Date: Fri, 4 Dec 2009 00:42:46 +0100

Hi,

I got this working just about an ago ...

web.xml:

<persistence-unit-ref>
     <persistence-unit-ref-name>persistence/hd</persistence-unit-ref-
name>
     <persistence-unit-name>hd</persistence-unit-name>
</persistence-unit-ref>

application-context.xml:

<bean
class=
"org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor"
>
     <property name="persistenceUnits">
             <map>
                 <entry key="MyPU" value="persistence/hd"/>
                </map>
     </property>
</bean>

<!-- see http://static.springsource.org/spring/docs/2.5.x/api/org/springframework/transaction/jta/JtaTransactionManager.html
  -->
<tx:jta-transaction-manager/>
<!-- see http://static.springsource.org/spring/docs/2.5.x/reference/transaction.html
  -->
<tx:annotation-driven/>

Hope this helps ...

Bye,
Ralph


Kurz gehalten, da vom iPhone gesendet

Am 04.12.2009 um 00:16 schrieb "Eve Pokua" <gorgeous65_at_msn.com>:

> Hello,
>
> Below is my persistence.xml-
>
> <?xml version="1.0" encoding="UTF-8"?>
> <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="ENTERPRISE-ejbPU" transaction-type="JTA">
> <jta-data-source>jdbc_/EnterpriseDB2</jta-data-source>
> <exclude-unlisted-classes>false</exclude-unlisted-classes>
> <properties>
> </properties>
> </persistence-unit>
> </persistence>
>
>
> How do I find the name of my -persistence-unit-ref-name?
>
> I use the following and I get deployment error
>
> <persistence-unit-ref-name>ENTERPRISE-ejbPU</persistence-unit-ref-
> name>
>
> Deploying application in domain failed; Could not resolve a
> persistence unit corresponding to the persistence-unit-ref-name
> [ENTERPRISE-ejbPU] in scope of the module called [gfdeploy#C:\jee
> \ENTERPRISE\dist\gfdeploy\ENTERPRISE-war_war]. Please verify your
> application.
>
> I need to specify it within my web.xml in-order to use @Persistence
> in my spring JEE
> application.
>
> Thanking you.
>
> eve
>
>
>
> Use Hotmail to send and receive mail from your different email
> accounts. Find out how.