Aadil Pala

Greenhorn
+ Follow
since Nov 01, 2004
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Aadil Pala

To all Spring/Hibernate Gurus,

I am using the following code(in bold), but I get an exception when i try to delete the data from the sourceDao within the transaction(exception is given below). I even tried copying data to a different list before passing it to the delete method, but it still gives the same exception.

Remember, the copying part is not in the transaction. It only has writing to one database and deleting from the copied database(so read only trxs dont work). Is there a way I could manually detach the list from the first session??

pData = sourceDao.getSourceData(startDate, endDate);

DefaultTransactionDefinition def = new DefaultTransactionDefinition();
def.setPropagationBehavior(TransactionDefinition.P ROPAGATION_REQUIRED);
TransactionStatus status = this.secTxManager.getTransaction(def);
try{

pageCount = secArchiveDao.archive(pData);
sourceDao.deleteSourceData(pData);
secTxManager.commit(status);
success = true;

} catch (Exception ex)
{
secTxManager.rollback(status);

}



Exception:
org.springframework.orm.hibernate3.HibernateSystem Exception: Illegal attempt to associate a collection with two open sessions; nested exception is org.hibernate.HibernateException: Illegal attempt to associate a collection with two open sessions
org.hibernate.HibernateException: Illegal attempt to associate a collection with two open sessions
at org.hibernate.collection.AbstractPersistentCollect ion.setCurrentSession(AbstractPersistentCollection .java:237)
at org.hibernate.event.def.OnUpdateVisitor.processCol lection(OnUpdateVisitor.java:41)
at org.hibernate.event.def.AbstractVisitor.processVal ue(AbstractVisitor.java:104)
at org.hibernate.event.def.AbstractVisitor.processVal ue(AbstractVisitor.java:64)
at org.hibernate.event.def.AbstractVisitor.processEnt ityPropertyValues(AbstractVisitor.java:58)
at org.hibernate.event.def.AbstractVisitor.process(Ab stractVisitor.java:129)
at org.hibernate.event.def.DefaultDeleteEventListener .onDelete(DefaultDeleteEventListener.java:74)
at org.hibernate.impl.SessionImpl.delete(SessionImpl. java:579)
at org.springframework.orm.hibernate3.HibernateTempla te$26.doInHibernate(HibernateTemplate.java:703)
at org.springframework.orm.hibernate3.HibernateTempla te.execute(HibernateTemplate.java:312)
at org.springframework.orm.hibernate3.HibernateTempla te.deleteAll(HibernateTemplate.java:699)
at org.tiaa.secarchive.dao.impl.SecProductionCltDAOIm pl.deleteSourceData(SecProductionCltDAOImpl.java:7 6)
at org.tiaa.secarchive.delegate.impl.SecArchiveDelega teImpl.archive(SecArchiveDelegateImpl.java:86)
at org.tiaa.secarchive.schedule.impl.JobImpl.archive( JobImpl.java:328)
at org.tiaa.secarchive.schedule.impl.JobImpl.execute( JobImpl.java:210)
at org.tiaa.secarchive.schedule.impl.DaemonImpl.run(D aemonImpl.java:239)
at java.lang.Thread.run(Thread.java:534)
org.tiaa.j2eeinfra.exception.TiaaRuntimeException: There are no open seeds in the database. New Seeds need to be created !
at org.tiaa.secarchive.schedule.impl.JobImpl.checkSee dsAvailability(JobImpl.java:415)
at org.tiaa.secarchive.schedule.impl.JobImpl.execute( JobImpl.java:80)
at org.tiaa.secarchive.schedule.impl.DaemonImpl.run(D aemonImpl.java:239)
at java.lang.Thread.run(Thread.java:534)

Any help is greatly appreciated:
Thanks
Aadil
To all Spring/Hibernate Gurus,

I am using the following code(in bold), but I get an exception when i try to delete the data from the sourceDao within the transaction(exception is given below). I even tried copying data to a different list before passing it to the delete method, but it still gives the same exception.

Remember, the copying part is not in the transaction. It only has writing to one database and deleting from the copied database(so read only trxs dont work). Is there a way I could manually detach the list from the first session??

pData = sourceDao.getSourceData(startDate, endDate);

DefaultTransactionDefinition def = new DefaultTransactionDefinition();
def.setPropagationBehavior(TransactionDefinition.P ROPAGATION_REQUIRED);
TransactionStatus status = this.secTxManager.getTransaction(def);
try{

pageCount = secArchiveDao.archive(pData);
sourceDao.deleteSourceData(pData);
secTxManager.commit(status);
success = true;

} catch (Exception ex)
{
secTxManager.rollback(status);

}



Exception:
org.springframework.orm.hibernate3.HibernateSystem Exception: Illegal attempt to associate a collection with two open sessions; nested exception is org.hibernate.HibernateException: Illegal attempt to associate a collection with two open sessions
org.hibernate.HibernateException: Illegal attempt to associate a collection with two open sessions
at org.hibernate.collection.AbstractPersistentCollect ion.setCurrentSession(AbstractPersistentCollection .java:237)
at org.hibernate.event.def.OnUpdateVisitor.processCol lection(OnUpdateVisitor.java:41)
at org.hibernate.event.def.AbstractVisitor.processVal ue(AbstractVisitor.java:104)
at org.hibernate.event.def.AbstractVisitor.processVal ue(AbstractVisitor.java:64)
at org.hibernate.event.def.AbstractVisitor.processEnt ityPropertyValues(AbstractVisitor.java:58)
at org.hibernate.event.def.AbstractVisitor.process(Ab stractVisitor.java:129)
at org.hibernate.event.def.DefaultDeleteEventListener .onDelete(DefaultDeleteEventListener.java:74)
at org.hibernate.impl.SessionImpl.delete(SessionImpl. java:579)
at org.springframework.orm.hibernate3.HibernateTempla te$26.doInHibernate(HibernateTemplate.java:703)
at org.springframework.orm.hibernate3.HibernateTempla te.execute(HibernateTemplate.java:312)
at org.springframework.orm.hibernate3.HibernateTempla te.deleteAll(HibernateTemplate.java:699)
at org.tiaa.secarchive.dao.impl.SecProductionCltDAOIm pl.deleteSourceData(SecProductionCltDAOImpl.java:7 6)
at org.tiaa.secarchive.delegate.impl.SecArchiveDelega teImpl.archive(SecArchiveDelegateImpl.java:86)
at org.tiaa.secarchive.schedule.impl.JobImpl.archive( JobImpl.java:328)
at org.tiaa.secarchive.schedule.impl.JobImpl.execute( JobImpl.java:210)
at org.tiaa.secarchive.schedule.impl.DaemonImpl.run(D aemonImpl.java:239)
at java.lang.Thread.run(Thread.java:534)
org.tiaa.j2eeinfra.exception.TiaaRuntimeException: There are no open seeds in the database. New Seeds need to be created !
at org.tiaa.secarchive.schedule.impl.JobImpl.checkSee dsAvailability(JobImpl.java:415)
at org.tiaa.secarchive.schedule.impl.JobImpl.execute( JobImpl.java:80)
at org.tiaa.secarchive.schedule.impl.DaemonImpl.run(D aemonImpl.java:239)
at java.lang.Thread.run(Thread.java:534)

Any help is greatly appreciated:
Thanks
Aadil
I am trying to writed a couple of zip files using the output stream but after that I need to move to another JSP by using the ActionForward but it does not work
My code
ServletOutputStream stream = response.getOutputStream();
stream.print( zipFile );
stream.flush();
stream.close();
return actionMapping.findForward(FORWARD_SUCCESS);

Is there an alternative approach using which I can forward it.
Thanks
20 years ago