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

         

         

         

         

         

 

 

Reply via email to