Announcement Announcement Module
No announcement yet.
A question about JTA transactions with Spring and Hibernate Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • A question about JTA transactions with Spring and Hibernate

    Hi all, i have an environment set up with xa jta transactions with Spring + Hibernate + Jotm. I configured everything following the instructions of various articles but the only mistake or disillusion i found was that i was just able to run successfully changing the mapping files of the entities.
    For example i have 3 entities User, Authorities and Role,
    User has a collection of Roles and a collection of Authorities,
    User is mapped to data base#1 but Authorities and Role are mapped tables in data base#2.
    In any configuration of jotm with spring there are two datasources with two sessionFactories each of them points to a different group of entity mapping files, each group of mapping files correspond to one different data base.

    When i ran my jotm environment i get an error saying that User has an association with entity Role but this last one was not mapped, the only way everything worked ok was by eliminating the association from User to Role in the mapping file of User. It means that i had to take the control in my hands of load the Role collection and save the Role collection when a User object is loaded or saved to the database, this behavior was not what i imagined.

    I was thinking that the distributed transaction setting was a level above the model and it's mapping to data base, that without modify the model mapping it was possible to set transaction behavior distributed or local.

    It is possible that this be a mistake of mine, that i'm missing some piece or this is the normal behavior of distributed transactions using Spring and Hibernate?

    Thank you very much.
    Last edited by maykell; Feb 7th, 2011, 09:24 AM.

  • #2
    Hi, please can anybody answer me?
    I'll appreciate any help.