Hi gerhard,
ok i'll test it with 1.1.8. But why is this a problem of OWB and not of CODI? By the way, why does it work when we annotate the complete class? Whats the difference? In your example http://jsfatwork.irian.at/semistatic/jsf_fullstack_cdi.html the @transactional is in the service. When we do so the interceptor (TransactionalInterceptorStrategy) throws a Nullpointer because no entityManager is available in Service. Entitymanger ist Injected in Dao like in your example. Mit freundlichen Grüssen / With best regards Steffen Herter Finanzen, Controlling, IT ZF-Konzern/Finance, Controlling, IT ZF Group Informatik ZF-Konzern/Information Technology ZF Group FC Engineering Applikationen ZF-Konzern/FC Engineering Application ZF Group ZF Friedrichshafen AG D-88038 Friedrichshafen, Deutschland/Germany Telefon/Phone +49 -7541 77-8801, Telefax/Fax +49 7541 77-908801 mailto:[email protected] Vorsitzender des Aufsichtsrats/Chairman of the Supervisory Board: Prof. Dr. Giorgio Behr Vorstand/Board of Management: Dr. Stefan Sommer (Vorsitzender/CEO), Dr. Konstantin Sauer, Dr. Peter Ottenbruch, Jürgen Holeksa, Dr. Gerhard Wagner, Reinhard Buhl, Rolf Lutz, Wilhelm Rehm Sitz/Headquarters: Friedrichshafen Handelsregistereintrag Amtsgericht Ulm HRB 630206/Trade register of the municipal court of Ulm HRB 630206 Von: Gerhard Petracek [mailto:[email protected]] Gesendet: Mittwoch, 20. März 2013 12:05 An: MyFaces Development Betreff: Re: Apache Myfaces12 Codi Tomcat 7 - Transaction Problems hi steffen, yes - it's the same as you would annotate all methods manually. owb v1.1.8 will be released within the next days. please file an issue at [1], if it still happens with v1.1.8. regards, gerhard [1] https://issues.apache.org/jira/browse/OWB http://www.irian.at Your JSF/JavaEE powerhouse - JavaEE Consulting, Development and Courses in English and German Professional Support for Apache MyFaces 2013/3/20 <[email protected]> Hi gerhard, OWB Version is 1.0.0. But this happens also with OWB 1.1.6. Annotation the doa class with @transactional works. But the consequence is that every method in the doa class (find, refresh, update) is running in a transaction!?!? Regards Steffen Von: Gerhard Petracek [mailto:[email protected]] Gesendet: Mittwoch, 20. März 2013 10:58 An: MyFaces Development Betreff: Re: Apache Myfaces12 Codi Tomcat 7 - Transaction Problems hi steffen, it would be great to get further details. esp. the concrete version of owb you are using and if it also happens with annotating the class (instead of the methods). regards, gerhard http://www.irian.at Your JSF/JavaEE powerhouse - JavaEE Consulting, Development and Courses in English and German Professional Support for Apache MyFaces 2013/3/20 <[email protected]> Hi gerhard, thanks for your Reply. I think that the TransactionalInterceptor and TransactionalInterceptorStrategy gets calles from codi (org.apache.myfaces.extensions.cdi.jpa.impl.transaction) and no Transaction is available. This Interceptor to start a Transaction is not called when we use generics in the IpersonDaoSuperInterface. Regards steffen Von: Gerhard Petracek [mailto:[email protected]] Gesendet: Mittwoch, 20. März 2013 10:20 An: MyFaces Development Betreff: Re: Apache Myfaces12 Codi Tomcat 7 - Transaction Problems short addition - that means: codi isn't responsible to trigger the interceptor itself. that's the part openwebbeans has to do. regards, gerhard http://www.irian.at Your JSF/JavaEE powerhouse - JavaEE Consulting, Development and Courses in English and German Professional Support for Apache MyFaces 2013/3/20 Gerhard Petracek <[email protected]> hi steffen, first of all: welcome @ myfaces if EntityTransaction#begin and (#commit or #rollback) get called, the part done by codi is fine and it's a different issue. regards, gerhard http://www.irian.at Your JSF/JavaEE powerhouse - JavaEE Consulting, Development and Courses in English and German Professional Support for Apache MyFaces 2013/3/20 <[email protected]> Hello, Problem with codi(1.0.5) Transactions and Java (1.6/1.7) generics. Infrastructure: Myfaces12 Jpa2 (eclipslink 2.4) Codi 1.0.5 Tomcat 7 OpenWebBeans 1 See Classes below Problem is: When we inject the Interface IpersonDao in the Service Class (PersonServerImpl) and do the following: dao.delete(person) à No Transaction is openend and nothing happens!!!!! doa.persist(person)à Transaction is opened and entity is saved. Difference is that in the IpersonDaoSuperInterface the delete function contains generic arguments and the persist fuction has a concrete Object (person). But we need the generic type for all function in the IpersonDaoSuperInterface. When we inject the Concrete Implementation of the dao ( @Inject private PersonDao dao) in PersonServerImpl the delete function also works. Question. Why cant we inject the Dao Interface when we use java generics in the interface hierarchy??? Service Class: public class PersonServerImpl implements PersonService { @Inject private IPersonDao dao; public void removePerson(Person person) { dao.delete(person); } public Person savePerson(Person person) { return dao.persist(person); } } Dao Class: public class PersonDao implements IPersonDao { @Transactional public void delete(Person entity) { em.remove(em.merge(entity)); } @Transactional public Person persist(Person entity) { em.persist(entity); return entity; } ... } IpersonDao Interface: public interface IPersonDao extends IpersonDaoSuperInterface<Person> { public abstract List<Person> loadAll(); public abstract Person loadById(Serializable id); public abstract List<Person> findByLastName(String lastname); } IpersonDaoSuperInterface: public interface IpersonDaoSuperInterface<T extends DbObject> { public abstract void delete(T entity); public abstract Person persist(Person entity); public abstract T update(T entity); } Thanks fore help steffen
