Announcement Announcement Module
No announcement yet.
Programmatic Transaction Management? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Programmatic Transaction Management?

    Is it possible to programmatically manage local Hibernate transactions in the layer above your Spring-managed, declarative AOP Service objects?

    For example, say you've got two Spring-managed beans A, and B both of which have declarative transactions applied to them in the Spring context. If you're in a Struts action, for example, and you want a single transaction to encompass both the calls on A and B without requiring the Struts action be managed by Spring how can you accomplish this? I.E. what transaction object do you use, how do you get a reference to it, etc.

  • #2
    In order for Spring to apply transactions on A and B it has to manage them. If you want to use the objects inside Struts you have to get a hold of them from Spring context and you can do that through the Struts integration (which you can find more about inside the documentation). Even though the transaction of A and B it's started declaratively you can add code in a programatical way from your code through TransactionTemplate. See again the reference documentation for more details (