Board index » jbuilder » Best pattern for EJB 'virtual' underlying data source?

Best pattern for EJB 'virtual' underlying data source?


2004-03-02 01:26:29 AM
jbuilder24
I'm building an EJB based software app that is using CMP.
I'm trying to make the design virtual so that the product can compliment existing data systems. For instance, the design includes a 'Customer' entity. As it stands now I have a 'CustomerManager' stateless session bean that acts as a facade to a set of customer related entity beans - all of which use CMP. These CMP entity beans point at structures in my own application specific schema.
However, given that practically all sites are likely to already have a customer database I'm wondering what the best design pattern is to help abstract this. In reality this means allowing the customer CMP entity beans to be reconfigured to point at a completely different data source.
Am I right in thinking that a CMP based JAR can only support s a single JDBC connection? If so, should I break the customer related entities into a seperate JAR?
(I'm using JBoss3.x and MySQL)
 
 

Re:Best pattern for EJB 'virtual' underlying data source?

In article <40437245$ XXXX@XXXXX.COM >,
XXXX@XXXXX.COM says...
Hi,
Quote
Am I right in thinking that a CMP based JAR can only support
a single JDBC connection? If so, should I break the customer
related entities into a seperate JAR?

(I'm using JBoss3.x and MySQL)
In Jboss each Entity bean can use a different datasource if required.
That being said, if each of you customers has a different 'customers'
database, the structure is likely to be different for each one. So
unless you want to keep a number of different 'customer' beans in a
single jar, I would create a separate CustomerEJB.jar for each customer
that exposes a standard interface (e.g. a SLSB) that the rest of you
system uses.
Phil
 

Re:Best pattern for EJB 'virtual' underlying data source?

How and where do you define multiple JDBC data sources in JBoss3.x?
"Phil Shrimpton" < XXXX@XXXXX.COM >wrote in message
Quote
In article <40437245$ XXXX@XXXXX.COM >,
XXXX@XXXXX.COM says...

Hi,

>Am I right in thinking that a CMP based JAR can only support
>a single JDBC connection? If so, should I break the customer
>related entities into a seperate JAR?
>
>(I'm using JBoss3.x and MySQL)

In Jboss each Entity bean can use a different datasource if required.
That being said, if each of you customers has a different 'customers'
database, the structure is likely to be different for each one. So
unless you want to keep a number of different 'customer' beans in a
single jar, I would create a separate CustomerEJB.jar for each customer
that exposes a standard interface (e.g. a SLSB) that the rest of you
system uses.

Phil
 

{smallsort}

Re:Best pattern for EJB 'virtual' underlying data source?

In article <404430f6$ XXXX@XXXXX.COM >,
XXXX@XXXXX.COM says...
Hi,
Quote
>In Jboss each Entity bean can use a different datasource if required.

How and where do you define multiple JDBC data sources in JBoss3.x?
You just need to create as many xxxx-ds.xml files as you need, or do you
mean something else?
Phil
 

Re:Best pattern for EJB 'virtual' underlying data source?

So I create n x 'xxxx-ds.xml' fires... ... how do I specifically link CMP
entity bean 'A' to a non default ds?
"Phil Shrimpton" < XXXX@XXXXX.COM >wrote in message
Quote
In article <404430f6$ XXXX@XXXXX.COM >,
XXXX@XXXXX.COM says...

Hi,

>>In Jboss each Entity bean can use a different datasource if required.
>
>How and where do you define multiple JDBC data sources in JBoss3.x?


You just need to create as many xxxx-ds.xml files as you need, or do you
mean something else?

Phil
 

Re:Best pattern for EJB 'virtual' underlying data source?

In article <40458ed1$ XXXX@XXXXX.COM >,
XXXX@XXXXX.COM says...
Hi,
Quote
So I create n x 'xxxx-ds.xml' fires... ... how do I specifically link CMP
entity bean 'A' to a non default ds?
You need to set it in the jbosscmp-jdbc.xml deployment descriptor
(location of which varies depending on which version of JBuilder, and
which open tool you are using)
Phil