Announcement Announcement Module
Collapse
No announcement yet.
Configure Spring to use no transactions at all Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Configure Spring to use no transactions at all

    Hello!

    I am a newbie with Spring and maybe this will look like a dumb question. I work at an application with Spring, Struts, Hibernate where I basically don't need transactions (all database commits are made through a service). Is it possible to configure Spring in such a way that it will not use any transaction at all? If it is, where can I find some documentation about this issue?

    I know that it's not recommended not to have transactions, but each time I use the method getSessionFactory().getCurrentSession() I get a different session instead of the same session. So I get a different session for each transaction. My database it broken into more locations so to access data I always need to do 2 things: set the right database (from the country that I need to access) and use the data from that database (read, modify, etc). You can see that it's impossible to get the data if you don't have the country for it.

    If it's not possible to setup Spring with no transactions is there any possibility that I can use the same Session for two operations:
    1) set the right country,
    2) get the data that I want?
    Sure I could add the setCountry for each method in each DAO, but it would be quite messy and a lot of unnecesarry code.

    Best regards,
    xtfire80
Working...
X