Hi,
I think you're missing the transaction advice, it's mentioned at the bottom
on this page:
https://tapestry.apache.org/hibernate-user-guide.html
Finally, you should use the HibernateTransactionAdvisor to add transaction
advice:
@Match("*DAO")
public static void adviseTransactions(HibernateTransactionAdvisor advisor,
MethodAdviceReceiver receiver)
{
advisor.addTransactionCommitAdvice(receiver);
}
This advice method is configured to match against any service whose id ends
with "DAO", such as "PersonDAO".
The advisor scans the service interface and identifies any methods with the
@CommitAfter annotation.
On Thu, Feb 4, 2016 at 4:03 PM, abangkis <[email protected]> wrote:
> I managed to setup and import the simple project to github if anyone have
> the time to look at it. https://github.com/abangkis/CommitTest. First time
> using git, let me know if something is missing.
>
> Thanks
>
> On Thu, Feb 4, 2016 at 5:53 AM, abangkis <[email protected]> wrote:
>
> > Hello, I've just recently migrated from Eclipse + Ant + Tomcat to
> IntelliJ
> > IDEA 15 CE + Gradle + Jetty. At first all of my development setup is
> > working fine and then I realized that my @CommitAfter annotation is not
> > being honored, while other query runs fine. I'm using Tapestry 5.4.0 from
> > jcenter.
> >
> > To confirm my problem, I created a simple project with a single page with
> > an add method:
> >
> > @CommitAfter
> > public void onActionFromAdd(){
> > logger.debug("trying add with commit after");
> >
> > User user = new User();
> > user.setPassword("");
> > user.setName("testing user 3");
> >
> > userManager.add(user);
> > // try {
> > // manager.commit();
> > // } catch (Exception e) {
> > // e.printStackTrace();
> > // }
> >
> > }
> >
> >
> > If i manually commit using Injected HibernateSessionManager in the page,
> > it will work. But using @CommitAfter annotation isn't. Anybody know why
> is
> > this happening?
> >
> > Thanks
> >
> > --
> > http://www.mreunionlabs.net/ <http://www.mreunion-labs.net/>
> > twitter : @mreunionlabs @abangkis
> > page : https://plus.google.com/104168782385184990771
> >
>
>
>
> --
> http://www.mreunionlabs.net/ <http://www.mreunion-labs.net/>
> twitter : @mreunionlabs @abangkis
> page : https://plus.google.com/104168782385184990771
>
--
Dmitry Gusev
AnjLab Team
http://anjlab.com