-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: problems with FlushModeType.MANUAL
PostPosted: Wed Mar 18, 2009 5:34 pm 
Hibernate version: 3.2.4.sp1.cp04

Seam version: 2.0.2

Plz explain what's going on here in terms of the exceptions in the latter two cases. thx.

Code:
@Begin(join=true)   
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
public void searchSerialNumbers()
{      

         topOneWorkOrdersList = storedProcedureDAO.getTopOneWorkOrdersBySerialNumber(serialNumber, siteId);
         if (topOneWorkOrdersList != null && topOneWorkOrdersList.size() > 0)
         {
               NewWorkOrdersBean newWorkOrdersBean = (NewWorkOrdersBean)topOneWorkOrdersList.get(0);
               persist(newWorkOrdersBean);
               entityManager.flush();
         }      
}


result: no problem, SMPC flushed, tx's commit, etc.


/**********************************************************************************************************************************************/


Code:
@Begin(join=true, flushMode=FlushModeType.MANUAL)   
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
public void searchSerialNumbers()
{      

         topOneWorkOrdersList = storedProcedureDAO.getTopOneWorkOrdersBySerialNumber(serialNumber, siteId);
         if (topOneWorkOrdersList != null && topOneWorkOrdersList.size() > 0)
         {
               NewWorkOrdersBean newWorkOrdersBean = (NewWorkOrdersBean)topOneWorkOrdersList.get(0);
               persist(newWorkOrdersBean);
               entityManager.flush();
         }      
}

result on flush(): Caused by: javax.persistence.TransactionRequiredException: no transaction is in progress
at org.hibernate.ejb.AbstractEntityManagerImpl.flush(AbstractEntityManagerImpl.java:301)
at org.jboss.seam.persistence.EntityManagerProxy.flush(EntityManagerProxy.java:90)
at com.cox.bets.session.BulkCreateRepairCaseAction.searchSerialNumbers(BulkCreateRepairCaseAction.java:148)


/**********************************************************************************************************************************************/

Code:
@Begin(join=true, flushMode=FlushModeType.MANUAL)
public void searchSerialNumbers()
{
   topOneWorkOrdersList = storedProcedureDAO.getTopOneWorkOrdersBySerialNumber(serialNumber, siteId);
   if (topOneWorkOrdersList != null && topOneWorkOrdersList.size() > 0)
   {
         NewWorkOrdersBean newWorkOrdersBean = (NewWorkOrdersBean)topOneWorkOrdersList.get(0);
         persist(newWorkOrdersBean);
         entityManager.flush();
   }   
}


The following exception occurs when a method is called after the flush().

Caused by: org.hibernate.exception.GenericJDBCException: Cannot open connection
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29)
at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:426)
at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:144)
at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:140)
at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1547)
at org.hibernate.loader.Loader.doQuery(Loader.java:673)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
at org.hibernate.loader.Loader.doList(Loader.java:2220)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
at org.hibernate.loader.Loader.list(Loader.java:2099)
at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:289)
at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1695)
at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:142)
at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:152)
at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:65)
... 139 more
Caused by: org.jboss.util.NestedSQLException: Transaction is not active: tx=TransactionImple < ac, BasicAction: a2e052a:a73:49c12c15:3c5 status: ActionStatus.ABORT_ONLY >; - nested throwable: (javax.resource.ResourceException: Transaction is not active: tx=TransactionImple < ac, BasicAction: a2e052a:a73:49c12c15:3c5 status: ActionStatus.ABORT_ONLY >)
at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:96)
at org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider.getConnection(InjectedDataSourceConnectionProvider.java:47)
at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:423)
... 152 more
Caused by: javax.resource.ResourceException: Transaction is not active: tx=TransactionImple < ac, BasicAction: a2e052a:a73:49c12c15:3c5 status: ActionStatus.ABORT_ONLY >
at org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:319)
at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:402)
at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:849)
at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:90)
... 154 more

this is the method exec'd after the flush():

Code:
private void loadRepairHistory()
   {
      String query = " select er.equipmentRepairId, "+
                  " e.serialNumber, "+
                  " ddv.description, "+
                  " sum(erc.cost) as Cost "+
                  " from Equipment e "+
                  " inner join EquipmentRepair er on er.equipmentId = e.equipmentId "+
                  " left outer join EquipmentRepairCost erc on er.equipmentRepairId = erc.equipmentRepairId "+
                  " left outer join ListValue ddv on er.equipmentRepairTypeCode = ddv.code "+
                  " left outer join List dd on dd.listId = ddv.listId "+
                  " where e.serialNumber = :serialNumber and "+
                  " dd.listName = :repairTypeDropDown "+
                  " group by er.equipmentRepairId, "+
                  " e.serialNumber, "+
                  " ddv.description ";
                              
      repairHistoryList = entityManager.createNativeQuery(query)
                               .setParameter("serialNumber", serialNumber)
                               .setParameter("repairTypeDropDown", REPAIR_TYPE_DROP_DOWN)
                               .getResultList();
      
      if (repairHistoryList != null)
         log.info("loadRepairHistory(): repairHistoryList.size() = " + repairHistoryList.size());
      
   }


Top
  
 
 Post subject: Re: problems with FlushModeType.MANUAL
PostPosted: Sat Jul 25, 2009 12:19 pm 
related thread in Seam forum:

http://seamframework.org/Community/TransactionProblemCouldNotEnlistInTransaction


Top
  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.