You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jake Vang <va...@googlemail.com> on 2010/06/21 06:56:19 UTC

i need more documentation on applicationContext.xml

hi, i've been reading and studying
http://struts.apache.org/2.0.14/docs/struts-2-spring-2-jpa-ajax.html.
i want to know what is actually going on in applicationContext.xml.
for example, what do these two lines do? please explain or refer me to
better documentation.

 <bean id="transactionManager"
        class="org.springframework.orm.jpa.JpaTransactionManager">
        <property name="entityManagerFactory" ref="entityManagerFactory" />
    </bean>

    <tx:annotation-driven transaction-manager="transactionManager" />

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: i need more documentation on applicationContext.xml

Posted by Jake Vang <va...@googlemail.com>.
thanks Martin. that gives me a little more confidence. that takes a
little mystery away from that XML file.

by the way, do you know any books that discusses Struts 2 (the latest
latest version 2.1.x)? i would purchase it in a heartbeat.

On Mon, Jun 21, 2010 at 11:42 AM, Martin Gainty <mg...@hotmail.com> wrote:
> a listing of  persistence-providers
>
> //notice the vendorAdapter changes for every vendor
> Toplink: <bean id="entityManagerFactory"
> class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
>    vendorAdapter
>    <bean class="org.springframework.orm.jpa.vendor.TopLinkJpaVendorAdapter">
>     <property name="database" value="HSQL"/>
>     <property name="showSql" value="true"/>
>     <property name="generateDdl" value="true"/>
>    </bean>
>   </property>
>    TransactionManager: ?
>
> Spring OpenJpa:   <bean id="entityManagerFactory"
> class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
>             <bean
> class="org.springframework.orm.jpa.vendor.OpenJpaVendorAdapter">
>                 <property name="database" value="HSQL"/>
>                 <property name="showSql" value="true"/>
>                 <property name="generateDdl" value="true"/>
>               </bean>
>       TransactionManager: ?
>
> Hibernate:  <bean id="entityManagerFactory"
> class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
>    <property name="jpaVendorAdapter">
>    <bean
> class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
>     <property name="database" value="HSQL"/>
>     <property name="showSql" value="true"/>
>     <property name="generateDdl" value="true"/>
>    </bean>
>   </property>
>  TransactionManager: ?
>
> //Spring SharedEntityManager supports EntityManagerFactory thru
> transactionManager:
>  <bean id="entityManager"
> class="org.springframework.orm.jpa.support.SharedEntityManagerBean">
>   <property name="entityManagerFactory" ref="entityManagerFactory"/>
>  </bean>
> //transactionManager
>  <bean id="transactionManager"
> class="org.springframework.orm.jpa.JpaTransactionManager">
>   <property name="entityManagerFactory" ref="entityManagerFactory"/>
>   <property name="dataSource" ref="dataSource"/>
>  </bean>
>
>
> conclusion seems to be we can implement both the entityManager and
> transactionManager
> but only if wholly configured to use entityManagerFactory's (based on
> jpaVendorAdapter vendor specific configuration)
>
> Martin Gainty
> ______________________________________________
> Jogi és Bizalmassági kinyilatkoztatás/Verzicht und
> Vertraulichkeitanmerkung/Note de déni et de confidentialité
>
>
> Ez az üzenet bizalmas.  Ha nem ön az akinek szánva volt, akkor kérjük, hogy
> jelentse azt nekünk vissza. Semmiféle továbbítása vagy másolatának készítése
> nem megengedett.  Ez az üzenet csak ismeret cserét szolgál és semmiféle jogi
> alkalmazhatósága sincs.  Mivel az electronikus üzenetek könnyen
> megváltoztathatóak, ezért minket semmi felelöség nem terhelhet ezen üzenet
> tartalma miatt.
>
> Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
> Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
> Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
> dient lediglich dem Austausch von Informationen und entfaltet keine
> rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
> E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
>
> Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
> destinataire prévu, nous te demandons avec bonté que pour satisfaire
> informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie
> de ceci est interdite. Ce message sert à l'information seulement et n'aura
> pas n'importe quel effet légalement obligatoire. Étant donné que les email
> peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
> aucune responsabilité pour le contenu fourni.
>
>
>
>
>> To: user@struts.apache.org; vangjake@googlemail.com
>> Subject: Re: i need more documentation on applicationContext.xml
>> Date: Mon, 21 Jun 2010 10:04:57 -0400
>> From: sturner@MIT.EDU
>>
>>
>> On Mon, 21 Jun 2010 00:56:19 -0400, Jake Vang <va...@googlemail.com>
>> wrote:
>>
>> > hi, i've been reading and studying
>> > http://struts.apache.org/2.0.14/docs/struts-2-spring-2-jpa-ajax.html.
>> > i want to know what is actually going on in applicationContext.xml.
>> > for example, what do these two lines do? please explain or refer me to
>> > better documentation.
>> >
>> > <bean id="transactionManager"
>> > class="org.springframework.orm.jpa.JpaTransactionManager">
>> > <property name="entityManagerFactory" ref="entityManagerFactory"
>> > />
>> > </bean>
>> >
>> > <tx:annotation-driven transaction-manager="transactionManager" />
>> >
>>
>> Hi Jake,
>>
>> This file holds the Spring configuration. You'll need to read up on Spring
>> - they have excellent documentation at:
>>
>> http://www.springsource.org/
>>
>> Steve
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>
> ________________________________
> Hotmail is redefining busy with tools for the New Busy. Get more from your
> inbox. See how.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: i need more documentation on applicationContext.xml

Posted by Martin Gainty <mg...@hotmail.com>.
a listing of  persistence-providers


//notice the vendorAdapter changes for every vendor 
Toplink: <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">

   vendorAdapter

   <bean class="org.springframework.orm.jpa.vendor.TopLinkJpaVendorAdapter">
    <property name="database" value="HSQL"/>
    <property name="showSql" value="true"/>
    <property name="generateDdl" value="true"/>
   </bean>
  </property>

   TransactionManager: ?


Spring OpenJpa:   <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">   

            <bean class="org.springframework.orm.jpa.vendor.OpenJpaVendorAdapter">
                <property name="database" value="HSQL"/>
                <property name="showSql" value="true"/>
                <property name="generateDdl" value="true"/>
              </bean>

      TransactionManager: ?

 

Hibernate:  <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">

   <property name="jpaVendorAdapter">
   <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
    <property name="database" value="HSQL"/>
    <property name="showSql" value="true"/>
    <property name="generateDdl" value="true"/>
   </bean>
  </property>

 TransactionManager: ?


//Spring SharedEntityManager supports EntityManagerFactory thru transactionManager: 

 <bean id="entityManager" class="org.springframework.orm.jpa.support.SharedEntityManagerBean">
  <property name="entityManagerFactory" ref="entityManagerFactory"/>
 </bean>

//transactionManager 

 <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
  <property name="entityManagerFactory" ref="entityManagerFactory"/>
  <property name="dataSource" ref="dataSource"/>
 </bean>


 

conclusion seems to be we can implement both the entityManager and transactionManager 
but only if wholly configured to use entityManagerFactory's (based on jpaVendorAdapter vendor specific configuration)

Martin Gainty 
______________________________________________ 
Jogi és Bizalmassági kinyilatkoztatás/Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité


 
Ez az üzenet bizalmas.  Ha nem ön az akinek szánva volt, akkor kérjük, hogy jelentse azt nekünk vissza. Semmiféle továbbítása vagy másolatának készítése nem megengedett.  Ez az üzenet csak ismeret cserét szolgál és semmiféle jogi alkalmazhatósága sincs.  Mivel az electronikus üzenetek könnyen megváltoztathatóak, ezért minket semmi felelöség nem terhelhet ezen üzenet tartalma miatt.

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.



 

> To: user@struts.apache.org; vangjake@googlemail.com
> Subject: Re: i need more documentation on applicationContext.xml
> Date: Mon, 21 Jun 2010 10:04:57 -0400
> From: sturner@MIT.EDU
> 
> 
> On Mon, 21 Jun 2010 00:56:19 -0400, Jake Vang <va...@googlemail.com> 
> wrote:
> 
> > hi, i've been reading and studying
> > http://struts.apache.org/2.0.14/docs/struts-2-spring-2-jpa-ajax.html.
> > i want to know what is actually going on in applicationContext.xml.
> > for example, what do these two lines do? please explain or refer me to
> > better documentation.
> >
> > <bean id="transactionManager"
> > class="org.springframework.orm.jpa.JpaTransactionManager">
> > <property name="entityManagerFactory" ref="entityManagerFactory" 
> > />
> > </bean>
> >
> > <tx:annotation-driven transaction-manager="transactionManager" />
> >
> 
> Hi Jake,
> 
> This file holds the Spring configuration. You'll need to read up on Spring 
> - they have excellent documentation at:
> 
> http://www.springsource.org/
> 
> Steve
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
 		 	   		  
_________________________________________________________________
Hotmail is redefining busy with tools for the New Busy. Get more from your inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_2

Re: i need more documentation on applicationContext.xml

Posted by Jens Hadlich <j3...@googlemail.com>.
Hi Jake,

the <tx:annotation-driven /> simply tells Spring to put transactional 
advice on any class or method that has an @Transactional annotation on it.

Regards,
Jens

Am 21.06.2010 18:16, schrieb Jake Vang:
> Stephen,
>
> i know it is a spring xml file. i can tell that with the<bean
> id="transactionManager".../>  element, they are defining a transaction
> manager. however, what does<tx:annotation-driven transaction-manager
> .../>  do? to me, intuitively, it defines a transaction manager that
> will process by annotations.
>
> the tutorial that gives this applicationContext.xml shows us how to
> get things working, but doesn't really explain in detail "why" we are
> doing what we are doing. that's kind of what i meant.
>
> On Mon, Jun 21, 2010 at 10:04 AM, Stephen Turner<st...@mit.edu>  wrote:
>    
>> On Mon, 21 Jun 2010 00:56:19 -0400, Jake Vang<va...@googlemail.com>
>> wrote:
>>
>>      
>>> hi, i've been reading and studying
>>> http://struts.apache.org/2.0.14/docs/struts-2-spring-2-jpa-ajax.html.
>>> i want to know what is actually going on in applicationContext.xml.
>>> for example, what do these two lines do? please explain or refer me to
>>> better documentation.
>>>
>>>   <bean id="transactionManager"
>>>         class="org.springframework.orm.jpa.JpaTransactionManager">
>>>         <property name="entityManagerFactory" ref="entityManagerFactory" />
>>>     </bean>
>>>
>>>     <tx:annotation-driven transaction-manager="transactionManager" />
>>>
>>>        
>> Hi Jake,
>>
>> This file holds the Spring configuration. You'll need to read up on Spring -
>> they have excellent documentation at:
>>
>> http://www.springsource.org/
>>
>> Steve
>>
>>      
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>    


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: i need more documentation on applicationContext.xml

Posted by Jake Vang <va...@googlemail.com>.
Stephen,

i know it is a spring xml file. i can tell that with the <bean
id="transactionManager".../> element, they are defining a transaction
manager. however, what does <tx:annotation-driven transaction-manager
.../> do? to me, intuitively, it defines a transaction manager that
will process by annotations.

the tutorial that gives this applicationContext.xml shows us how to
get things working, but doesn't really explain in detail "why" we are
doing what we are doing. that's kind of what i meant.

On Mon, Jun 21, 2010 at 10:04 AM, Stephen Turner <st...@mit.edu> wrote:
>
> On Mon, 21 Jun 2010 00:56:19 -0400, Jake Vang <va...@googlemail.com>
> wrote:
>
>> hi, i've been reading and studying
>> http://struts.apache.org/2.0.14/docs/struts-2-spring-2-jpa-ajax.html.
>> i want to know what is actually going on in applicationContext.xml.
>> for example, what do these two lines do? please explain or refer me to
>> better documentation.
>>
>>  <bean id="transactionManager"
>>        class="org.springframework.orm.jpa.JpaTransactionManager">
>>        <property name="entityManagerFactory" ref="entityManagerFactory" />
>>    </bean>
>>
>>    <tx:annotation-driven transaction-manager="transactionManager" />
>>
>
> Hi Jake,
>
> This file holds the Spring configuration. You'll need to read up on Spring -
> they have excellent documentation at:
>
> http://www.springsource.org/
>
> Steve
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: i need more documentation on applicationContext.xml

Posted by Stephen Turner <st...@MIT.EDU>.
On Mon, 21 Jun 2010 00:56:19 -0400, Jake Vang <va...@googlemail.com>  
wrote:

> hi, i've been reading and studying
> http://struts.apache.org/2.0.14/docs/struts-2-spring-2-jpa-ajax.html.
> i want to know what is actually going on in applicationContext.xml.
> for example, what do these two lines do? please explain or refer me to
> better documentation.
>
>  <bean id="transactionManager"
>         class="org.springframework.orm.jpa.JpaTransactionManager">
>         <property name="entityManagerFactory" ref="entityManagerFactory"  
> />
>     </bean>
>
>     <tx:annotation-driven transaction-manager="transactionManager" />
>

Hi Jake,

This file holds the Spring configuration. You'll need to read up on Spring  
- they have excellent documentation at:

http://www.springsource.org/

Steve

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org