Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
JPA support for Weld SE, implementation of CDI for Java SE
Java
branch: master
Failed to load latest commit information.
src
.gitignore
README.txt Added README and .gitignore
nb-configuration.xml @Observes not working, @ApplicationScoped constructed twice
nbactions.xml @Observes not working, @ApplicationScoped constructed twice
pom.xml @Observes not working, @ApplicationScoped constructed twice

README.txt

Got inspired by
http://www.laliluna.de/articles/2011/01/12/jboss-weld-jpa-hibernate.html


This implementation will cause a separate entity manager for every transactional method. If you are aware of EJB3 or Spring transactions, then you will probably know the transaction type requires_new.
It is the same approach. If you want to achieve context propagation as in a EJB3, we need to improve our implementation. I leave the task to you but will outline the required steps.

    * Add an attribute to the @Transactional annotation which defines if the method should reuse an existing transaction.
    * Improve the interceptor
          o Check if the @Transactional annotation defines the reuse of an existing transaction
          o If an existing TX should be reused, it could check if the store has already a current entity manager. We could add a service method to the store like boolean hasEntitymanager()
          o If an existing TX should be reused and an entity manager exists already, do nothing else handle the transaction and create an entity manager.


Other way would be to implement doInJpa() like in Spring 2.5.
Something went wrong with that request. Please try again.