You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Dmitry Gusev <dm...@gmail.com> on 2015/07/23 23:03:22 UTC

Advanced transaction support for tapestry JPA applications

Hello Tapestry users!

I would like to share with you a new small tapestry5 library that may be
helpful for tapestry JPA applications:

https://github.com/satago/tapestry-jpa-transactions

1) It overrides @CommitAfter annotation with support for nested calls (only
top-most method will actually commit transaction)
2) Simple service for wrapping Runnable/Invokable objects with transactions
when you need precise control over transactions
3) Before/after commit callbacks
4) Support @Injects in entity listeners when used with JPA 2.1

Please see GitHub readme for details.

It's built against tapestry 5.3.7, but should also work with latest 5.4
versions (not tested).


-- 
Dmitry Gusev

AnjLab Team
http://anjlab.com

Re: Advanced transaction support for tapestry JPA applications

Posted by Dmitry Gusev <dm...@gmail.com>.
Hi Tony,

I think so, but new TransactionalUnitWorker works the same as default one (
CommitAfterWorker).
It won't start a transaction unless you have @CommitAfter on execution path.

Maybe you're talking about starting transactions if no DB calls were made
from method annotated with @CommitAfter?

If that's the case, the answer is no -- it will begin a transaction anyway.

I did lazy such transactions some time ago when transaction created only on
first call to database:
http://dmitrygusev.blogspot.ru/2010/09/gae-and-tapestry5-data-access-layer.html

(referenced source code is lost somewhere on GitHub, but I can find it for
you if you're interested).

This was good for GAE, because GAE bills you for number of API calls.
I might add it at some point if there will be an interest.

On Fri, Jul 24, 2015 at 3:10 PM, Tony Nelson <tn...@starpoint.com> wrote:

> This does look very interesting.
>
> A while back, Howard built a custom commit handler for me, that delays
> creating the transaction until a method with @CommitAfter is seen.  Does
> your library have a similar side effect, of not starting the transaction
> because only methods marked with @CommitAfter get wrapped in a
> TransactionalUnit?
>
> I look forward to testing out your library when time permits.
>
> Thanks
> Tony
>
> > On Jul 23, 2015, at 5:03 PM, Dmitry Gusev <dm...@gmail.com>
> wrote:
> >
> > Hello Tapestry users!
> >
> > I would like to share with you a new small tapestry5 library that may be
> > helpful for tapestry JPA applications:
> >
> > https://github.com/satago/tapestry-jpa-transactions
> >
> > 1) It overrides @CommitAfter annotation with support for nested calls
> (only
> > top-most method will actually commit transaction)
> > 2) Simple service for wrapping Runnable/Invokable objects with
> transactions
> > when you need precise control over transactions
> > 3) Before/after commit callbacks
> > 4) Support @Injects in entity listeners when used with JPA 2.1
> >
> > Please see GitHub readme for details.
> >
> > It's built against tapestry 5.3.7, but should also work with latest 5.4
> > versions (not tested).
> >
> >
> > --
> > Dmitry Gusev
> >
> > AnjLab Team
> > http://anjlab.com
>
>
> Since 1982, Starpoint Solutions has been a trusted source of human capital
> and solutions. We are committed to our clients, employees, environment,
> community and social concerns.  We foster an inclusive culture based on
> trust, respect, honesty and solid performance. Learn more about Starpoint
> and our social responsibility at
> http://www.starpoint.com/social_responsibility
>
> This email message from Starpoint Solutions LLC is for the sole use of
> the intended recipient(s) and may contain confidential and privileged
> information.  Any unauthorized review, use, disclosure or distribution is
> prohibited.  If you are not the intended recipient, please contact the
> sender by reply email and destroy all copies of the original message.
> Opinions, conclusions and other information in this message that do not
> relate to the official business of Starpoint Solutions shall be understood
> as neither given nor endorsed by it.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Dmitry Gusev

AnjLab Team
http://anjlab.com

Re: Advanced transaction support for tapestry JPA applications

Posted by Tony Nelson <tn...@starpoint.com>.
This does look very interesting.

A while back, Howard built a custom commit handler for me, that delays creating the transaction until a method with @CommitAfter is seen.  Does your library have a similar side effect, of not starting the transaction because only methods marked with @CommitAfter get wrapped in a  TransactionalUnit?

I look forward to testing out your library when time permits.

Thanks
Tony

> On Jul 23, 2015, at 5:03 PM, Dmitry Gusev <dm...@gmail.com> wrote:
>
> Hello Tapestry users!
>
> I would like to share with you a new small tapestry5 library that may be
> helpful for tapestry JPA applications:
>
> https://github.com/satago/tapestry-jpa-transactions
>
> 1) It overrides @CommitAfter annotation with support for nested calls (only
> top-most method will actually commit transaction)
> 2) Simple service for wrapping Runnable/Invokable objects with transactions
> when you need precise control over transactions
> 3) Before/after commit callbacks
> 4) Support @Injects in entity listeners when used with JPA 2.1
>
> Please see GitHub readme for details.
>
> It's built against tapestry 5.3.7, but should also work with latest 5.4
> versions (not tested).
>
>
> --
> Dmitry Gusev
>
> AnjLab Team
> http://anjlab.com


Since 1982, Starpoint Solutions has been a trusted source of human capital and solutions. We are committed to our clients, employees, environment, community and social concerns.  We foster an inclusive culture based on trust, respect, honesty and solid performance. Learn more about Starpoint and our social responsibility at http://www.starpoint.com/social_responsibility

This email message from Starpoint Solutions LLC is for the sole use of  the intended recipient(s) and may contain confidential and privileged  information.  Any unauthorized review, use, disclosure or distribution is prohibited.  If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.  Opinions, conclusions and other information in this message that do not relate to the official business of Starpoint Solutions shall be understood as neither given nor endorsed by it.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Advanced transaction support for tapestry JPA applications

Posted by Charlouze <me...@charlouze.com>.
Hey !

All those features seems nice... I'll take a look at it !

Thanks a lot.

Cheers

Le jeu. 23 juil. 2015 à 23:05, Dmitry Gusev <dm...@gmail.com> a
écrit :

> Hello Tapestry users!
>
> I would like to share with you a new small tapestry5 library that may be
> helpful for tapestry JPA applications:
>
> https://github.com/satago/tapestry-jpa-transactions
>
> 1) It overrides @CommitAfter annotation with support for nested calls (only
> top-most method will actually commit transaction)
> 2) Simple service for wrapping Runnable/Invokable objects with transactions
> when you need precise control over transactions
> 3) Before/after commit callbacks
> 4) Support @Injects in entity listeners when used with JPA 2.1
>
> Please see GitHub readme for details.
>
> It's built against tapestry 5.3.7, but should also work with latest 5.4
> versions (not tested).
>
>
> --
> Dmitry Gusev
>
> AnjLab Team
> http://anjlab.com
>

Re: Advanced transaction support for tapestry JPA applications

Posted by Dmitry Gusev <dm...@gmail.com>.
Hi Kalle,

In JPA 2.1 it's BeanManager that is responsible for creating objects of
entity listeners.
BeanManager implementation from this library uses ObjectLocator.autobuild()
to create these instances,
so you may @Inject pretty much everything as you do with regular tapestry
services.

As for configuration property, maybe this:
https://docs.oracle.com/middleware/1213/toplink/java-reference/org/eclipse/persistence/config/PersistenceUnitProperties.html#CDI_BEANMANAGER


On Fri, Jul 24, 2015 at 8:12 PM, Kalle Korhonen <ka...@gmail.com>
wrote:

> Thanks Dmitry, looks excellent. Even so that I don't see any reason we
> shouldn't merge this to tapestry's core JPA integration at some point. I
> didn't read the code that carefully, but do the injectable JPA
> entitylisteners also support (totally non-spec) constructor injection? Do
> you know if the corresponding
> org.hibernate.jpa.AvailableSettings.CDI_BEAN_MANAGER
> is available in EclipseLink configuration and if so, what's the name of the
> property?
>
> Kalle
>
> On Thu, Jul 23, 2015 at 2:03 PM, Dmitry Gusev <dm...@gmail.com>
> wrote:
>
> > Hello Tapestry users!
> >
> > I would like to share with you a new small tapestry5 library that may be
> > helpful for tapestry JPA applications:
> >
> > https://github.com/satago/tapestry-jpa-transactions
> >
> > 1) It overrides @CommitAfter annotation with support for nested calls
> (only
> > top-most method will actually commit transaction)
> > 2) Simple service for wrapping Runnable/Invokable objects with
> transactions
> > when you need precise control over transactions
> > 3) Before/after commit callbacks
> > 4) Support @Injects in entity listeners when used with JPA 2.1
> >
> > Please see GitHub readme for details.
> >
> > It's built against tapestry 5.3.7, but should also work with latest 5.4
> > versions (not tested).
> >
> >
> > --
> > Dmitry Gusev
> >
> > AnjLab Team
> > http://anjlab.com
> >
>



-- 
Dmitry Gusev

AnjLab Team
http://anjlab.com

Re: Advanced transaction support for tapestry JPA applications

Posted by Kalle Korhonen <ka...@gmail.com>.
Thanks Dmitry, looks excellent. Even so that I don't see any reason we
shouldn't merge this to tapestry's core JPA integration at some point. I
didn't read the code that carefully, but do the injectable JPA
entitylisteners also support (totally non-spec) constructor injection? Do
you know if the corresponding
org.hibernate.jpa.AvailableSettings.CDI_BEAN_MANAGER
is available in EclipseLink configuration and if so, what's the name of the
property?

Kalle

On Thu, Jul 23, 2015 at 2:03 PM, Dmitry Gusev <dm...@gmail.com>
wrote:

> Hello Tapestry users!
>
> I would like to share with you a new small tapestry5 library that may be
> helpful for tapestry JPA applications:
>
> https://github.com/satago/tapestry-jpa-transactions
>
> 1) It overrides @CommitAfter annotation with support for nested calls (only
> top-most method will actually commit transaction)
> 2) Simple service for wrapping Runnable/Invokable objects with transactions
> when you need precise control over transactions
> 3) Before/after commit callbacks
> 4) Support @Injects in entity listeners when used with JPA 2.1
>
> Please see GitHub readme for details.
>
> It's built against tapestry 5.3.7, but should also work with latest 5.4
> versions (not tested).
>
>
> --
> Dmitry Gusev
>
> AnjLab Team
> http://anjlab.com
>