I need to manage two consistent datasources. Tried to use one EntityBean to manipulate the two datasource. When create an item, the bean will connect to each datasource one by one and create an item. However, when the item created in first database successful, enven if the second one failed, the first one not been rolled back, the item has been in the database. But I need the first one rollback to keep the two database consistent.
And, I also tried using same bean but different datasource and JNDI name, and deploy the bean again. When try to lookup second bean by its second JNDI name, it's always connected to first(default) datasource. I think the two different JNDI name bind with same bean, the second bean not been created in the jboss server.
The other approach is create a new entity bean with same logic different bean name, JNDI name and datasource. That works, but it's hard to manage the source code when there are many this kind of beens.
Is there any idea to solve the sort of probem? Any idea will be appreciated.