Announcement Announcement Module
Collapse
No announcement yet.
Can I write multiple TransactionProxyFactoryBean in single applicationContext.xml fil Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Can I write multiple TransactionProxyFactoryBean in single applicationContext.xml fil

    I have two different beans, for one I have written

    For Bean 1.

    TransactionProxyFactoryBean
    HibernateTransactionManager
    LocalSessionFactoryBean
    and the bean class also.

    I want to know that, can I write second set of bean in the same ApplicationContext.xml file. Like this.

    For Bean 2

    TransactionProxyFactoryBean
    HibernateTransactionManager
    LocalSessionFactoryBean
    and the bean class also.

    If yes, please give me some example. Please let me know.

    Thanks.
    Last edited by ven12344; Jul 24th, 2012, 07:14 PM.

  • #2
    Please use [ code][/code ] tags when posting code.

    You can write as many as you want or need however it is not something you want nor should do as the TransactionProxyFactoryBean is deprecated. Also why on earth would you need multiple transactionmanagers and sessionfactories?! In general you need one if you connect to multiple databases you need several but then you also want to use jta (for cross resource transactions).

    For transactions I suggest a read of the transaction and aop chapter of the reference guide and learn how to use aop:config with tx:advice or tx:annotation driven as both are a better alternative as opposed to the TransactionProxyFactoryBean.

    Comment

    Working...
    X