• 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
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Entity Bean and mulitple datasource

 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
Is it possible to have multiple entity beans connecting to multiple datasources in one container?. If yes, Is it by listing the datasource name in bean specific JNDI ENC?
For eg: In one container,
Bean1 connects to DataSource1
Bean2 connects to DataSource2
I appreciate your help in advance.
Regards,
Pinal
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, it is possible. Let's say you have a bean implementation called MyEntityBean. You would need to
1) Deploy one EJB with MyEntityBean as the implementation having a resource reference to "DataSource1" in its ejb-jar.xml configs
2) Deploy another EJB with the same implementation class but having a resource reference in ejb-jar.xml pointing to "DataSource2"
 
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
can't we have 2 datasources in one ejb-xml file..
in this way there is no need to put them into 2 jars

regards
Naveen
 
Ranch Hand
Posts: 8948
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

can't we have 2 datasources in one ejb-xml file..


Yes, you can.
 
reply
    Bookmark Topic Watch Topic
  • New Topic