Hey ! You can define your DAO as service and get any other services you need in your DAO by adding parameters to your DAO constructor.
Le jeu. 23 avr. 2015 à 11:23, Poggenpohl, Daniel < daniel.poggenp...@isst.fraunhofer.de> a écrit : > Hi everyone, > > thank you for adressing my questions, I think that helped me to accomplish > my goal. > > One more question for the moment: > d) My dao-hibernate module, the DAO implementation module using hibernate > as a persistence provider... > Previously, in my single module project, I would have the DAO > implementation running as a service in Tapestry. Doing it that way, I could > @Inject the appropriate EntityManager. > I know I can still run the DAOs as services in Tapestry if I add them in > AppModule. > But how do I receive the appropriate EntityManager without @Inject? Is > there another simple way or do I have to manually create the EntityManager? > > (I know that I can add a dependency to tapestry5-annotations) > > Regards, > Daniel P. > > -----Ursprüngliche Nachricht----- > Von: Charlouze [mailto:m...@charlouze.com] > Gesendet: Mittwoch, 22. April 2015 16:59 > An: Tapestry users > Betreff: Re: AW: AW: Splitting a tapestry web app into modules > > hey ! > > here is my thoughts about your concerns : > > a) controllers should be services that are bound to the registry in a > ControllerModule class. > > b) persistence.xml file should probably be in your dao-hibernate module. > You can configure where to find this file in a Module class. > > c) thiago already answer this one :D > > Cheers, > Charles > > Le mer. 22 avr. 2015 à 16:43, Thiago H de Paula Figueiredo < > thiag...@gmail.com> a écrit : > > > On Wed, 22 Apr 2015 10:53:01 -0300, Poggenpohl, Daniel > > <daniel.poggenp...@isst.fraunhofer.de> wrote: > > > > > Hello, > > > > Hi! > > > > > First, to be generic with my DAO interfaces, I can't use > > > @CommitAfter on them, because then I'd need a dependency to > tapestry-jpa. > > > > If you use 5.4-beta-22 or up, you don't need to put the annotation in > > the interface anymore: you can put it on the service (in your case, > > DAO) implementation. Problem solved! :D > > > > If you're not using 5.4-beta-22 or up, you can come up with your own > > annotation and adapt the tapestry-jpa class which does the service > > decoration or advice, JpaTransactionAdvisor, then add this in module > class: > > > > @Match("*DAO") > > public static void adviseTransactionally( > > YourJpaTransactionAdvisor advisor, > > MethodAdviceReceiver receiver) { > > > > advisor.addTransactionCommitAdvice(receiver); > > } > > > > -- > > Thiago H. de Paula Figueiredo > > Tapestry, Java and Hibernate consultant and developer > > http://machina.com.br > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > > For additional commands, e-mail: users-h...@tapestry.apache.org > > > > >