Originally posted by Fiona Healy: Fiona, Two session beans can talk to each other as long as they are in the same enterprise application. It doesn't matter what they do or what databases they interact with.
Since you are using JDBC with database A, you get it back into a Java data structure (be it Strings or a data transfer object of your creation.) If you are using JDBC in database B, just write it the way you normally do.
If you are using entity beans, you can call ejbCreate() to add a new row to the table in database B. If it is an existing row, you can call a finder to get that entity bean and then setters for the updates.
Note that you will want to use an XA driver to support transactions across the two databases.
two session beans can talk to each other even if they're part of different enterprise apps, or even if they're running on different servers (if they have remote interfaces or web services interfaces). they only have to be a part of the same enterprise app if they *only* have local interfaces. that said however, you don't seem to have any good reason not to have them be part of the same enterprise app.
just to take a step back however - you say that you have a 'fields EJB' and a 'report EJB' - I assume from this you actually mean that you've got an 'Field' Entity Bean , and a 'Report' Entity Bean. If this is the case, then there's no need at all to have the 2 Session Beans that you also have talking to each other at all.
It sounds like what you really want is to have a Session Bean talk to your 'A' database (via JDBC, or via your existing Session bean if that's what you want), then create instances of the Entity Beans that are associated with your 'B' database (the container will call ejbCreate() after you call create() on the local or remote home interface).
And yes - an XA driver will allow you to have distributed 2-phase commit transactions across the 2 databases.
Dave Clark<br />Senior WebSphere Architect<br /><a href="http://www.versant.com" target="_blank" rel="nofollow">Versant Open Access - JDO2 & EJB3</a>
I�d like to suggest you a different approach. If all you need to do is to move data from one database to another, then using J2EE and EJB is maybe too much overhead. I would suggest you to use a totally different toll like openadaptor (http://www.openadaptor.org), which is free. This will let you move data from one data storage system (like database, ldap, jms, etc) to any other storage. It is very generic and the good part is that you don�t need to write any code; providing an appropriate configuration file is quite enough. It has a lot of interesting features (including filters and transformation, message hospitals, etc) and for your application could be a very fast and reliable solution. I hope this will help. Regards.
So what you are saying is to have one session bean interacting with the DB that holds the data that i want to transfer and the entity bean (Fields) to which i want to transfer the data to???
Once this is done, i have a scenario where there is a many to many unidirectional relationship. i.e. ReportEJB has many FieldEJB and FieldEJB can be associated with many ReportEJB. Reports need to know about fields but not the other way around
I have followed numerous examples on how to configure both the jbosscmp file and the ejb-jar file in order for two beans to have a many-many uni-directional relationship. I think i have done this succesfully as no errors are being thrown.
All my tables are building accordingly and i have my abstract accessors specified in both beans concerned but when i go to create a new report bean the link table is not populated.
Does it matter that FieldEJB is already populated and has read-only access?
Is there any examples out there with the actual manipulation of the data in the database as opposed to how to configure the META-INF files.
Also can i use remote beans in these relationships or does it have to be local???
You can thank my dental hygienist for my untimely aliveness. So tiny: