aries-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Charles Moulliard <cmoulli...@gmail.com>
Subject Re: How to translate Spring JPA into Aries JPA
Date Thu, 18 Nov 2010 16:37:40 GMT
Hi Timothy,

I'm at the DevoXX. So maybe we can discuss a little bit tomorrow. We 
have a stand (FuseSource).

How can I configure the container-manager JPA as you tell me that I 
configure it like Application-Manager JPA ?

Regards,

Charles

On 08/11/10 15:17, Timothy Ward wrote:
> Hi,
>
> It looks like you're trying to do Application-Managed JPA rather than container-managed
JPA with this example (i.e. you want to have an EntityManagerFactory and manage the EntityManager
lifecycle yourself).
>
> In this case you can just inject the persistence unit directly into the bean that wants
it with e.g.
>
> <bean id="persistenceBean" class="org.apache.Foo">
>    <jpa:unit unitname="camel" property="enitityManagerFactory"/>
> </bean>
>
> This encompasses all of the integration with global transactions as well as the JPA injection
via the setEntityManagerFactory method.
>
>
>
> Managed transactions can be configured using the transactions namespace e.g.
>
> <bean id="transacted" class="org.apache.Bar">
>    <tx:transaction/>
> </bean>
>
> This bean will have a "Required" transaction attribute for all public methods invoked
from outside the bean.
>
>
>
> These two concepts are often used together with container-managed persistence contexts
(i.e you let the container manage the EntityManager lifecycle). There are examples of this
in the Blog sample.
>
> <bean id="persistenceBean" class="org.apache.Foo">
>    <tx:transaction/>
>
>    <jpa:context unitname="camel" property="enitityManager"/>
> </bean>
>
>
> I hope this helps. If you'd like to put any of your experiences together it would be
great to start building some better documentation for the Aries JPA component.
>
> Regards,
>
> Tim
>
> ----------------------------------------
>> Hi,
>>
>> Do we have an example showing what we define like this in spring
>>
>> <bean id="transactionTemplate"
>> class="org.springframework.transaction.support.TransactionTemplate">
>> <property name="transactionManager">
>> <bean class="org.springframework.orm.jpa.JpaTransactionManager">
>> <property name="entityManagerFactory" ref="entityManagerFactory"/>
>> </bean>
>> </property>
>> </bean>
>>
>> <bean id="jpaTemplate" class="org.springframework.orm.jpa.JpaTemplate">
>> <property name="entityManagerFactory" ref="entityManagerFactory"/>
>> </bean>
>>
>> <bean id="entityManagerFactory"
>> class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean">
>> <property name="persistenceUnitName" value="camel"/>
>> </bean>
>>
>> but using Aries JPA and Aries Transaction now ?
>>
>> Regards,
>>
>> Charles M.
>> Apache ServiceMix, Camel and Karaf committer 		 	   		

Mime
View raw message