Results 1 to 9 of 9

Thread: Two/Dual Databases

  1. #1

    Default Two/Dual Databases

    Hello!

    I've gone through many threads of how to use spring roo with two databases but none are sufficient I feel. Specifically I need one database to be reverse engineered which will be a read-only database for drop down lists. And I need a second database to store other entity fields.

    Most of the things I've read are outdated or have errors in them when I try to recreate. I'm pretty new at all this spring stuff so some help would be much appreciated. Has anyone done this and can link me to a sample? Or is there any kind of support for this in roo? (from what I've read/seen there is no official support?)

    Thanks guys!

    I was trying to recreate this dual database example:
    http://viralpatel.net/blogs/2011/01/...iguration.html

    but keep getting this error:

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~

    INFO: Deploying configuration descriptor twodatabases.xml from /home/shelby/springsource/vfabric-tc-server-developer-2.5.0.RELEASE/spring-insight-instance/conf/Catalina/localhost
    Aug 15, 2011 5:50:49 PM org.apache.catalina.startup.SetContextPropertiesRu le begin
    WARNING: [SetContextPropertiesRule]{Context} Setting property 'source' to 'org.eclipse.jst.j2ee.server:twodatabases' did not find a matching property.
    Aug 15, 2011 5:50:49 PM org.apache.catalina.startup.HostConfig deployDescriptor
    SEVERE: Error deploying configuration descriptor twodatabases.xml

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~
    Last edited by epicdoom; Aug 15th, 2011 at 07:51 PM.

  2. #2
    Join Date
    Jun 2010
    Posts
    440

    Default

    Somehow my article wasn't published correctly...

    Add following code to the configuration provided -into web.xml-:
    Code:
    <filter-mapping>
         <filter-name>Spring OpenEntityManagerInViewFilter1</filter-name>
         <url-pattern>/*</url-pattern>
    </filter-mapping>
     
       <filter-mapping>
        <filter-name>Spring OpenEntityManagerInViewFilter2</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
     
     
    on the entities  assign the correspondent persistent unit name in the annotation as shown.
     
    @PersistenceContext(unitName="persistenceUnit1")
      transient EntityManager entityManager;

    Roogards
    jD

  3. #3

    Default

    It's JD! Awesome blog post man. I will try this out and get back to you if it works.

    I was wondering if you know
    if what I described was possible. i.e. Say I have an entity that writes field string --fieldName name into the Client Databases. And in the same
    entity I have another field reference which creates(reads) a dropdown list from the Master Database which is like "Select Chip-Type" and has a list of all the chips I support.

    I was wondering because you said that on the ENTITIES I need to describe the "persistent unit name". And if I'm using two databases within the same entity it would cause a problem right?

    Let me know if that wording was confusing.

    Thanks

  4. #4
    Join Date
    Jun 2010
    Posts
    440

    Default

    @epicdoom,

    If you liked this blog... Wait to see the book I am working on...
    It is pretty much like this post. Solution very hard to find in other places. Like master-detail, column sorting, dynamic menus, jQuery integration, performance calibration and other hot issues.
    All of them customized for the Roo community.

    2 points:
    1) On your question: I truly believe you can do with this configuration anything you can do with one db onto two or more db concurrently.
    2) For more information: check the exchanges I had with other developers -at the original article website- that succeeded with the configuration after struggling a little bit in the begging.




    Thank you for your comments and B. Roogards
    jD
    Last edited by delgad9; Aug 16th, 2011 at 03:14 PM.

  5. #5
    Join Date
    May 2006
    Location
    Madrid
    Posts
    382

    Default

    What publisher are you going to use for your book?, is there any preview release?

  6. #6
    Join Date
    Jun 2010
    Posts
    440

    Default

    @jbbarquero,

    Hola,

    Thank you for asking...
    I don't have any yet. I've tried several book houses but unfortunately they have turned me down*.
    Realizing the great need from the community on certain unsolved forum frequent questions -which basically these are the solutions that I am providing.
    I asked the endorsement from a VIP on the Spring Roo team several months ago. But nada/nothing has showed up on this regard. I thought that the endorsement could get the attention of a book publisher.

    I let you know when I get one.

    B. and unpublizized Roogards

    *R.K. Rowling story is my inspiration

  7. #7
    Join Date
    May 2006
    Location
    Madrid
    Posts
    382

    Default

    What a pitty! but don't give up, and good luck

  8. #8
    Join Date
    Jun 2010
    Posts
    440

    Default

    @jbbarquero,

    Hey muchas gracias...

    Nope, I won't give up. I know my Roo solutions are hard to find -sometimes unique- and have great value.

    I'll prevail.

    B. and determined Roogards
    jD

  9. #9
    Join Date
    Jun 2010
    Posts
    440

    Default Cleaned version of Two/Dual Databases configuration

    Hello Fellow Rooists,

    I posted again in my blog that deals with the configuration for accessing 2 databases with Roo. The post is at http://pragmatikroo.blogspot.com/201...databases.html. *

    For reasons out my control the first one published missed few details.

    The configuration has been successfully used by multiple developers all around the world with their Roo projects.


    I have plans to extended the configuration for programatically manage multiple datasources instead of using verbosed xml and to include service/repository approach.


    B. Roogards
    jD

    * The link is ok. I correct the misspell later.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •