Re: [JBoss-user] using CMP and defining the datasource at runtime

2003-10-05 Thread Adrian Brock
On Sun, 2003-10-05 at 16:53, Ionel GARDAIS wrote:
> Great !
> 
> Did I tell you that I love you ? :)
> 
> for my own knowledge, does a BMP can use a declared
> datasource or does it has to go through all the jdbc
> connection process ?
> 

Anything in the same VM can use a datasource.

Regards,
Adrian

> > Just create the CMP beans (don't include a
> > jbosscmp-jdbc.xml)
> > JBoss will create tables for the beans when they are
> > first deployed.
> > 
> > If the user doesn't like the tables or DefaultDS,
> > they can change
> > the definition by adding a jbosscmp-jdbc.xml to the
> > deployment.
> > 
> > Regards,
> > Adrian
> 
> =
-- 
 
Adrian Brock
Director of Support
Back Office
JBoss Group, LLC 
 



---
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


Re: [JBoss-user] using CMP and defining the datasource at runtime

2003-10-05 Thread Ionel GARDAIS
Great !

Did I tell you that I love you ? :)

for my own knowledge, does a BMP can use a declared
datasource or does it has to go through all the jdbc
connection process ?

> Just create the CMP beans (don't include a
> jbosscmp-jdbc.xml)
> JBoss will create tables for the beans when they are
> first deployed.
> 
> If the user doesn't like the tables or DefaultDS,
> they can change
> the definition by adding a jbosscmp-jdbc.xml to the
> deployment.
> 
> Regards,
> Adrian

=
-- 
Regards,
Ionel

___
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !
Yahoo! Mail : http://fr.mail.yahoo.com


---
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


Re: [JBoss-user] using CMP and defining the datasource at runtime

2003-10-05 Thread Adrian Brock
On Sun, 2003-10-05 at 16:26, Ionel GARDAIS wrote:
> I am trying to add an EJB load/store layer to the mail
> server developped by A. Oliver.
> 
> It needs to access :
> - a table with the usernames and passwords
> - 1 or more tables for the emails and attached files
> 

Just create the CMP beans (don't include a jbosscmp-jdbc.xml)
JBoss will create tables for the beans when they are first deployed.

If the user doesn't like the tables or DefaultDS, they can change
the definition by adding a jbosscmp-jdbc.xml to the
deployment.

Regards,
Adrian

> A CMP could allow an automatic table creation and easy
> finders manipulation.
> As the tables should be created on a database choosed
> by the user, the choices are : work with a CMP and
> allow the user to override the datasource (with all
> the problems you said) or to work with BMP, write all
> the queries and ask the user to provide
> connection-url, jdbc driver, username and password.
> 
> 
> Or maybe a BMP can use a declared datasource ?
> 
> > One of the aims of CMP is that your code is
> > independent
> > of the persistence mechansim (which is declared in
> > the
> > deployment). In principle it could be persisted to
> > a flat file system or an object db.
> > The idea of the datasource is specified at
> > deployment
> > (I want jdbc persistence).
> > 
> > Can you restate the problem in that context?
> 
> 
> =
-- 
 
Adrian Brock
Director of Support
Back Office
JBoss Group, LLC 
 



---
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


Re: [JBoss-user] using CMP and defining the datasource at runtime

2003-10-05 Thread Ionel GARDAIS
I am trying to add an EJB load/store layer to the mail
server developped by A. Oliver.

It needs to access :
- a table with the usernames and passwords
- 1 or more tables for the emails and attached files

A CMP could allow an automatic table creation and easy
finders manipulation.
As the tables should be created on a database choosed
by the user, the choices are : work with a CMP and
allow the user to override the datasource (with all
the problems you said) or to work with BMP, write all
the queries and ask the user to provide
connection-url, jdbc driver, username and password.


Or maybe a BMP can use a declared datasource ?

> One of the aims of CMP is that your code is
> independent
> of the persistence mechansim (which is declared in
> the
> deployment). In principle it could be persisted to
> a flat file system or an object db.
> The idea of the datasource is specified at
> deployment
> (I want jdbc persistence).
> 
> Can you restate the problem in that context?


=
-- 
Regards,
Ionel

___
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !
Yahoo! Mail : http://fr.mail.yahoo.com


---
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


Re: [JBoss-user] using CMP and defining the datasource at runtime

2003-10-05 Thread Alexey Loubyansky
If the databases (products) and schemas are the same. Then we could add 
support for it.

Scott M Stark wrote:

Ok, but the typical usecase people ask about is some failover scenario
or dev vs prod database selection where the type mappings are the same.




---
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


Re: [JBoss-user] using CMP and defining the datasource at runtime

2003-10-05 Thread Alexey Loubyansky
I don't think it is impossible.
Each specific datasource has its own type mappings and SQL 
functions/templates. At the moment, these are read and assigned to 
entity and field bridges at deployment time. And there is no way to 
change them at run time.
You could make a hack assigning a new datasource for an entity and it 
might work (making sure the entity bridge is the only source for the 
datasource). But, in general, the answer is no.

alex

Ionel GARDAIS wrote:

Well, here is what I want to do : I would like to
allow a CMP-like mechanism but with a user defined
datasource.
I could use BMP and read the connection-url,
driver-class, username and password from a file but as
these informations are available directly through a
declared datasource, a CMP could do the trick.
Any ideas are welcome

=




---
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


Re: [JBoss-user] using CMP and defining the datasource at runtime

2003-10-05 Thread Scott M Stark
Ok, but the typical usecase people ask about is some failover scenario
or dev vs prod database selection where the type mappings are the same.
--

Scott Stark
Chief Technology Officer
JBoss Group, LLC

Adrian Brock wrote:

On Sun, 2003-10-05 at 14:52, Scott M Stark wrote:

Write an mbean service that installs a javax.naming.spi.ObjectFactory at
the location you specify as the datasource and the ObjectFactory can
choose at runtime which DataSource to return.


Except there is no such dynamicity for type-mappings.
You have to know the db mappings when you create the jbosscmp-jdbc.xml
Regards,
Adrian


---
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


Re: [JBoss-user] using CMP and defining the datasource at runtime

2003-10-05 Thread Adrian Brock
On Sun, 2003-10-05 at 15:42, Ionel GARDAIS wrote:
> Well, here is what I want to do : I would like to
> allow a CMP-like mechanism but with a user defined
> datasource.
> 

One of the aims of CMP is that your code is independent
of the persistence mechansim (which is declared in the
deployment). In principle it could be persisted to
a flat file system or an object db.
The idea of the datasource is specified at deployment
(I want jdbc persistence).

Can you restate the problem in that context?

Regards,
Adrian

> I could use BMP and read the connection-url,
> driver-class, username and password from a file but as
> these informations are available directly through a
> declared datasource, a CMP could do the trick.
> 
> Any ideas are welcome
> 
> =
-- 
 
Adrian Brock
Director of Support
Back Office
JBoss Group, LLC 
 



---
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


Re: [JBoss-user] using CMP and defining the datasource at runtime

2003-10-05 Thread Ionel GARDAIS
Well, here is what I want to do : I would like to
allow a CMP-like mechanism but with a user defined
datasource.

I could use BMP and read the connection-url,
driver-class, username and password from a file but as
these informations are available directly through a
declared datasource, a CMP could do the trick.

Any ideas are welcome

=
-- 
Regards,
Ionel

___
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !
Yahoo! Mail : http://fr.mail.yahoo.com


---
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


Re: [JBoss-user] using CMP and defining the datasource at runtime

2003-10-05 Thread Adrian Brock
On Sun, 2003-10-05 at 15:20, Ionel GARDAIS wrote:
> Let say the datasource-mappings can be specified by
> the user at runtime too.

They cannot.

> If the datasource is specified by the user, will the
> CMP use the declared mapping or the "delegated"
> mapping ?
> 

The purpose of jbosscmp-jdbc.xml is to declare the mappings
from the EJB model to the referential db model.
There is one of these for each db vendor. :-(

If would be nice if you could use:

Guess

And it used the DatabaseMetaData to determine the
db's type mapping. 
But this isn't currently supported, and wouldn't work
if you had vendor specific mappings at the field level.

Regards,
Adrian

> > Except there is no such dynamicity for
> > type-mappings.
> > You have to know the db mappings when you create the
> > jbosscmp-jdbc.xml
> 
> 
> =
-- 
 
Adrian Brock
Director of Support
Back Office
JBoss Group, LLC 
 



---
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


Re: [JBoss-user] using CMP and defining the datasource at runtime

2003-10-05 Thread Ionel GARDAIS
Let say the datasource-mappings can be specified by
the user at runtime too.
If the datasource is specified by the user, will the
CMP use the declared mapping or the "delegated"
mapping ?

> Except there is no such dynamicity for
> type-mappings.
> You have to know the db mappings when you create the
> jbosscmp-jdbc.xml


=
-- 
Regards,
Ionel

___
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !
Yahoo! Mail : http://fr.mail.yahoo.com


---
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


Re: [JBoss-user] using CMP and defining the datasource at runtime

2003-10-05 Thread Adrian Brock
Wouldn't an alias serve your purpose?


   java:/ApplicationDS
   java:/OracleDS


I assume changing all the jbosscmp-jdbc.xml files is too much work?

Regards,
Adrian

On Sun, 2003-10-05 at 15:07, Ionel GARDAIS wrote:
> Huh ? heee, are there any examples of how to do such a
> thing ?
> 
>  --- Scott M Stark <[EMAIL PROTECTED]> a écrit : >
> Write an mbean service that installs a
> > javax.naming.spi.ObjectFactory at
> > the location you specify as the datasource and the
> > ObjectFactory can
> > choose at runtime which DataSource to return.
> 
> 
> =
-- 
 
Adrian Brock
Director of Support
Back Office
JBoss Group, LLC 
 



---
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


Re: [JBoss-user] using CMP and defining the datasource at runtime

2003-10-05 Thread Alexey Loubyansky
No. The datasource is used at deployment time to initialize mapping 
types, row locking syntax, autoincrementation, etc.

alex

Ionel GARDAIS wrote:

Hi,

is it possible to use a CMP bean but to override the
datasource from the xml files but a user defined
datasource, known at runtime ?
=




---
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


Re: [JBoss-user] using CMP and defining the datasource at runtime

2003-10-05 Thread Adrian Brock
On Sun, 2003-10-05 at 14:52, Scott M Stark wrote:
> Write an mbean service that installs a javax.naming.spi.ObjectFactory at
> the location you specify as the datasource and the ObjectFactory can
> choose at runtime which DataSource to return.

Except there is no such dynamicity for type-mappings.
You have to know the db mappings when you create the jbosscmp-jdbc.xml

Regards,
Adrian

-- 
 
Adrian Brock
Director of Support
Back Office
JBoss Group, LLC 
 



---
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


Re: [JBoss-user] using CMP and defining the datasource at runtime

2003-10-05 Thread Ionel GARDAIS
Huh ? heee, are there any examples of how to do such a
thing ?

 --- Scott M Stark <[EMAIL PROTECTED]> a écrit : >
Write an mbean service that installs a
> javax.naming.spi.ObjectFactory at
> the location you specify as the datasource and the
> ObjectFactory can
> choose at runtime which DataSource to return.


=
-- 
Regards,
Ionel

___
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !
Yahoo! Mail : http://fr.mail.yahoo.com


---
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


Re: [JBoss-user] using CMP and defining the datasource at runtime

2003-10-05 Thread Scott M Stark
Write an mbean service that installs a javax.naming.spi.ObjectFactory at
the location you specify as the datasource and the ObjectFactory can
choose at runtime which DataSource to return.
--

Scott Stark
Chief Technology Officer
JBoss Group, LLC

Ionel GARDAIS wrote:

Hi,

is it possible to use a CMP bean but to override the
datasource from the xml files but a user defined
datasource, known at runtime ?




---
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user