users@glassfish.java.net

Re: _at_Transactional in Spring not really using JTA [SOLVED]

From: Ryan de Laplante <ryan_at_ijws.com>
Date: Fri, 12 Sep 2008 14:18:17 -0400

I found the solution! When using JPA in Spring you have to tell the JPA
provider how to find the JTA transaction manager in persistence.xml :

For GlassFish's built-in TopLink Essentials (JPA RI) :

<properties>
    <property name="toplink.target-server" value="SunAS9"/>
</properties>


For Hibernate Entity Manager :

<properties>
    <property name="hibernate.transaction.manager_lookup_class"
value="org.hibernate.transaction.SunONETransactionManagerLookup"/>
</properties>


Nowhere on the Internet will you find a complete example on how to
create a Maven2 project to be run on GlassFish that uses the built-in
JTA and JPA providers, and only swap out EJB for Spring 2.5.5. Also how
to get the unit test environment set up for this. Soon I am going to
write a GlassFish Users FAQ and blog entry on how to do this.


Thanks,
Ryan


Ryan de Laplante wrote:
> I think you are referring to my own thread:
>
> http://forums.java.net/jive/thread.jspa?messageID=294441&#294441
>
> I thought I had it working but it turns out JTA isn't being used.
> When I run select queries everything works great. When I do a
> entityManager.merge(someEntity) it tells me that there is no active
> transaction.
>
> I found this thread in the Spring forums where someone else had the
> same problem. They said switching to Hibernate for JPA provider made
> JTA work:
>
> http://forum.springframework.org/showthread.php?t=36573
>
> I'm going to give that a try shortly if I don't find another solution
> in the GlassFish forums.
>
>
> Thanks,
> Ryan
>
>
>
> Marina Vatkina wrote:
>> Did you try to search GF forum? There were discussions about problems
>> and solutions not so long ago.
>>
>> Regards,
>> -marina
>>
>> Ryan de Laplante wrote:
>>> Hi,
>>>
>>> I have Spring 2.5 configured to use JTA and TopLink. The logs show
>>> that it detected JTA in GlassFish, and I am able to do SELECT
>>> queries with JPA. When I try to add/change/delete a record it tells
>>> me that there is no active transaction.
>>>
>>> http://forum.springframework.org/showthread.php?t=60035
>>>
>>> Can someone please help me? I am really stuck.
>>>
>>>
>>> Thanks,
>>> Ryan
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
>>> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
>> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>