Announcement Announcement Module
No announcement yet.
Portable sharding: DataNucleus & OpenJPA work, Hibernate doesn't Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Portable sharding: DataNucleus & OpenJPA work, Hibernate doesn't

    Hi all,

    I'm wondering if anyone can tell me why DataNucleus & OpenJPA work in my sample project (attached), but Hibernate fails. It appears as though Hibernate or Spring is holding on to a connection when it shouldn't.

    The idea is to come up with a portable physical sharding solution by leveraging Spring's AbstractRoutingDataSource. To run successfully with DataNucleus, extract & run "mvn clean test -P dn". With OpenJPA, "mvn clean test -P openjpa". Notice that there are no errors.

    Now, run with Hibernate with the command "mvn clean test -P hib" and see the errors. Again, I think it's that either Hibernate or Spring is not letting go of a connection when it should. Any pointers are appreciated.

    Attached Files

  • #2
    Closing in on problem -- looks like Spring+Hibernate or just Spring

    This post includes an example that might lead to the problem. In src/test/java, there are two test classes. The first, OrderPersistenceTests, works with DataNucleus & OpenJPA but fails with Hibernate. The second test, a slightly refactored version of the first, called OrderPersistenceTestsWithBeforeAndAfterTransaction Methods, makes all three ORMs work ok.

    Any ideas why the first test works for all except Spring+Hibernate but the second one works for all?

    To run for each ORM, here are the maven commands. Note that you have to clean each time because the tests require a new database.

    mvn clean test -Ddn=1
    mvn clean test -Ddn=2
    mvn clean test -Dopenjpa=1
    mvn clean test -Dopenjpa=2
    mvn clean test -Dhib=1 <-------this one fails
    mvn clean test -Dhib=2


    Attached Files