Yes Chris is right (see https://github.com/apache/tapestry-5/blob/master/tapestry-hibernate/src/main/java/org/apache/tapestry5/internal/hibernate/CommitAfterWorker.java), you need to depend on tapestry-hibernate. tapestry-hibernate-core is for non-web projects (where you need the advisor to tell to ioc when to commit).
Kalle On Thu, Feb 4, 2016 at 6:47 AM, Chris Poulsen <mailingl...@nesluop.dk> wrote: > I have not used the hibernate integration myself. But my guess is that you > should depend on tapestry-hibernate instead of tapestry-hibernate-core.... > As far as I can tell from the sources, the CommitAfterWorker class lives in > that module. > > HTH. > > -- > Chris > > On Thu, Feb 4, 2016 at 2:39 PM, abangkis <abang...@gmail.com> wrote: > > > Hi Dmitry, thanks for the response. I understand that if you wan't to do > a > > commit from your DAO (for example if your DAO is invoke by a scheduler, > or > > other non user interaction) you need to add the transaction advice. But > in > > my understanding if the action is from a tapestry page, you just need to > > add the commit after annotation on the page. I did this successfully in a > > few project when I'm still using eclipse. So i was wondering if this an > > intellij/jetty/gradle thing that a more experienced user of the IDE might > > know. > > > > On another note, this is also the first time I''m using maven based > > dependency, maybe there's something on there too :) > > > > On Thu, Feb 4, 2016 at 8:29 PM, Dmitry Gusev <dmitry.gu...@gmail.com> > > wrote: > > > > > 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 <abang...@gmail.com> 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 <abang...@gmail.com> 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 > > > > > > > > > > > -- > > http://www.mreunionlabs.net/ <http://www.mreunion-labs.net/> > > twitter : @mreunionlabs @abangkis > > page : https://plus.google.com/104168782385184990771 > > >