select queries without @Transactional annotation

69 views
Skip to first unread message

Ahmad Mirzaei

unread,
Aug 25, 2010, 9:34:44 AM8/25/10
to warp-core
Hi,
I am working on a web based project using Tomcat, Guice, Hibernate and
PostgreSQL database.
We are using session per request strategy and managed hibernate
sessions.
The problem I have is that we have some select queries without any
explicit @Transactional annotation.
As a result after executing these kind of scenarios we will end up
with "Idle in Transaction" processes in database.
I am wondering when the hibernate session is closed by
SessionPerRequestFilter at the end of http request why these pending
Transactions are not committed ?
Is there any work around for this issue other than making all these
kind of methods @Transactional ? ( do something in configuration
maybe? )
Thank you all in advance.
--Amir

Dan Retzlaff

unread,
Aug 26, 2010, 10:54:20 AM8/26/10
to warp...@googlegroups.com
Hi Ahmad,

I don't think there is any kind of rollback-on-session-close
configuration option. You can look for yourself, but tracing back
references to JDBCTransaction.rollback() in hibernate-core doesn't
turn up anything. Personally I would recommend making your select
operations use explicit transactions. But as an alternative, you might
try registering your own servlet filter (within Warp-Persist's
PersistenceFilter) with
sessionFactoryProvider.get().getCurrentSession().getTransaction().rollback().

Dan

> --
> You received this message because you are subscribed to the Google Groups "warp-core" group.
> To post to this group, send email to warp...@googlegroups.com.
> To unsubscribe from this group, send email to warp-core+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/warp-core?hl=en.
>
>

Reply all
Reply to author
Forward
0 new messages