• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

ejb 3.0 and multiple databases

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am new to EJB 3.0.I have one db2 database and 3 as400 databases. when I create a new record in one of the db2 table(db2 database),I have to create the same record in 3 as400 table(3 seperate as400 databases).This has to happen in one transaction.whenever something any of the insert fails I need to rollback everything. I use ejb 3.0 session bean(business layer) and JPA(OR mapping).

I created 4 ejb projects.I created 4 seperate persistence units for each databases.I am planning to call my main method from from first EJB project Session bean and within that I planning to use 4 methods to insert into didfferent databses.

EjbProject1
sessinbean
main mehtod

(
insert mthod1 ===> to insert DB2 table
insert method2 ===> call remotely EjbProject2 session bean method to insert to As400 database1
insert method3 ===> call remotely EjbProject3 session bean method to insert to As400 database3
insert method4 ===> call remotely EjbProject4 session bean method to insert to As400 database4 }
all these should be part of one transation.


I do not know whether it is going to work or not? any body has any idea? Anybody has example that deals with multiple databases or how distributed transaction work with multiple databsaes in EJB 3.0?

Please help
Many thanks
 
author
Posts: 304
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That should work fine as long as a) the methods execute within the context of the same JTA transaction and b) the drivers fully support XA
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic