-
1. Re: Two DS used in one EJB method, DB non-XA - what should I
frito Jul 24, 2003 6:17 AM (in response to roxburd)You can't be sure that commiting both local transactions is really working. You need a xa transaction for.
You will have some more work to do if you need consistency over both datasources without xa. You could use BMT and commit both datasources by yourself, or you can leave the CMT and just switch switch off the log4j for this warning. It is only a warning telling you things you still know: you are working with two local transactions which are handled one by one.
Greetings,
Frito -
2. Re: Two DS used in one EJB method, DB non-XA - what should I
roxburd Jul 24, 2003 6:55 AM (in response to roxburd)Thanks for the post Frito,
I don't think I can use BMT because the method is in on entity bean - apparently, entity beans must use CMT.
If I switch log4j off, I have to do it in the method and leave it off because the output only gets generated by the container when it commits the transaction. Then, since execution control has left my code, I'll lose all subsequent log4j output since I don't have any opportunity to switch it back on. That is not acceptable since some of the log output is critically important.
And actually, I would like to keep the trans ACIDic if possible.
Thanks for your advice though. It looks like I have two options:
- ditch one of the DS and make SQL calls directly to one of the databases. Ah, that cannot be made ACIDic though can it - if the CMT transaction fails to commit when the method exits and returns control to the container I don't get any opportunity to rollback the non-DS one.
- put a session bean in front of the entity bean... since session beans can use BMT it could wrap the two tansactions in one ? ? ?
Regards,
Dave -
3. Re: Two DS used in one EJB method, DB non-XA - what should I
frito Jul 24, 2003 7:22 AM (in response to roxburd)IMHO, an enity bean should not handle with datasources at all (it is done by its container).
Best practice might be using a session bean working with your entity bean(s).
But without using xa you can't be sure both transactions do the same thing (commit, rollback). Only xa can do.
If you nead consistency over both datasources without xa you have do you own "xa" transaction with some extra code when commiting, which must be BMT of course.
Greetings,
Frito