Announcement Announcement Module
Collapse
No announcement yet.
Service without transactions fails to close Hibernate sess Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Service without transactions fails to close Hibernate sess

    I have a business service that has to perform reiterative queries against two Hibernate DAOs (each working against a different data source).

    I can't wrap the service in a JTA transaction because one of the DBs doesn't support transactions at all (it's a legacy turnkey system).

    The first query to each DAO works fine, but the second query kicks out "SessionImpl.finalize - unclosed connection, forgot to call close() on your session?" and the service hangs. I suspect this is because Spring isn't managing Hibernate's sessions since a transaction isn't wrapped around the service, right?

    What are my options until the turnkey system suports JTA transactions? :?

    Thanks in advance,
    Scott

  • #2
    A dummy subclass of AbstractPlatformTransactionManager, with no ops for doCommit and doRollback, might do the trick. Haven't tried it--just thinking aloud.

    Comment


    • #3
      That's interesting. But wouldn't something need to flush and close the Hibernate sessions?

      Scott

      Comment


      • #4
        Wondering if anyone else has ideas...?

        Thanks in advance,
        Scott

        Comment


        • #5
          For what it's worth I did a bunch or research into configuring JTA to work with MySQL (which doesn't have XA drivers as far as I can tell) and an Informix database that doesn't have logging turned on and have opted to give up on the JTA route for now.

          Rod, I think you're right - subclassing AbstractPlatformTransactionManager seems to be the most straightforward course at this point.

          If I'm going to do this, would there be any interest in a "HibernateTransactionManager" that accepts a list of sessionFactories or dataSources? It's not JTA, but it might be useful to others working with multiple JDBC-only and Hibernate-only datasources. Just trying to determine how much time I should spend on making this subclass useful for other environments.

          Thanks,
          Scott

          Comment


          • #6
            Argh, encountering some show-stoppers. See http://forum.springframework.org/viewtopic.php?t=3765 .

            Scott

            Comment

            Working...
            X