3 Replies Latest reply on Jan 5, 2004 6:43 AM by juha

    One Entity-Bean - Many DBs (Multi-DB support)

    nlmarco

      Hello!

      I saw that already some other people had the same or a similar question, but noone answered it yet:

      I need to have the possibility to decide according to the current situation from which database an EntityBean is loaded. How can I achieve this?

      And: I need to create and deploy databases at runtime. I can't register them in an xml-file. How can I do that?

      The purpose is the following: Every user has his own database. All DBs have the same structure, but different data. Because one user can interact with the data of other users, it's not sufficient to have the data completely separated by user, but everytime, an entity bean is loaded, I have to define, from which database. When I create a new user, a new database is created (and deployed) as well.

      Please help, it's urgent! If this does not work with CMP, I've to look for another possibility. Thus, I please you for any good suggestion (CMP or not), if you have done sth. similar already.

      Best regards, Marco.

        • 1. Re: One Entity-Bean - Many DBs (Multi-DB support)

          The only way to do this with CMP is to deploy the same entity for each user (and therefore each database) separately.

          • 2. Re: One Entity-Bean - Many DBs (Multi-DB support)
            nlmarco

            Hello Juha,

            thousand thanks for your answer!!!

            Because we need it all very dynamic (an administrator should simply click a button to add a user and create a database), it seems CMP is not the right way to go. I read some documents comparing CMP with JDO and we're now pretty sure that we'll use a combination of j2ee session beans on jboss and sth. like hibernate or apache-ojb to do the persistence.

            Do you have experience with such a solution or know some useful links (e.g. examples)?

            Best regards and I whish you a wunderful, healthy, happy 2004!!!

            Marco ;-)

            P.S.: Is the jboss group already aware of the deadly threat SOFTWARE PATENTS? Did you already sign against them?

            http://swpat.ffii.org/papers/europarl0309/demands/index.en.html
            http://petition.eurolinux.org/

            • 3. Re: One Entity-Bean - Many DBs (Multi-DB support)

               

              Because we need it all very dynamic (an administrator should simply click a button to add a user and create a database), it seems CMP is not the right way to go.


              This would not be a restriction for JBoss CMP, you can deploy a new CMP instance and a datasource at runtime and generate a configuration for your entity that connects to a new database. It still requires a CMP container per user though.

              For POJO persistence, Hibernate is the way to go (JBG provides support and soon training for it).