You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oozie.apache.org by "Hadoop QA (JIRA)" <ji...@apache.org> on 2011/09/10 03:29:09 UTC
[jira] [Resolved] (OOZIE-143) GH-117: Refactor DB access to JPA
[ https://issues.apache.org/jira/browse/OOZIE-143?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Hadoop QA resolved OOZIE-143.
-----------------------------
Resolution: Fixed
> GH-117: Refactor DB access to JPA
> ---------------------------------
>
> Key: OOZIE-143
> URL: https://issues.apache.org/jira/browse/OOZIE-143
> Project: Oozie
> Issue Type: Bug
> Reporter: Hadoop QA
>
> All JPA access should be done using the following:
> public interface JPACommand {
> public void call(EntityManager em) throws JPACommandException;
> }
> //This replaces current StoreService
> public class JPAAccessorService implements Service {
> private EntityManagerFactory emf;
> @Override
> public void init(Services services) throws ServiceException {
> //create EMF
> }
> @Override
> public void destroy() {
> //destroy EMF
> }
> @Override
> public Class<? extends Service> getInterface() {
> return JPAAccessorService.class;
> }
> public void execute(JPACommand jpaCommand) throws JPACommandException {
> //all instrumentation is missing here
> EntityManager em = emf.createEntityManager();
> try {
> jpaCommand.call(em);
> }
> finally {
> // check if TRX is open, log WARNING
> // rollback TRX
> em.close();
> }
> }
> }
> Also, JPA named queries should be used ONLY to do SELECT QUERIES. All modifications of bean should be done using
> attached beans.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira