RE: Default domain in cayenne.xml

From: Gentry, Michael \(Contractor\) ("Gentry,)
Date: Thu May 18 2006 - 13:27:13 EDT

  • Next message: Mike Kienenberger: "Error when join table spans datamaps"

    I could see that potentially causing confusion. In some of my apps, I have about 7 DataDomains. I explicitly request the one I want to use based upon the workflow of the application. To me, this leads to less magic when debugging and reading the source code.

    Of course, you could always provide a getDomain() in your code somewhere which handles a default you have set up. I'm not sure if that would help or not. I'm sure we could add it to Cayenne, but I'm not sure if it makes enough sense or would be too useful. Maybe some others could chime in on the idea.

    Thanks,

    /dev/mrg

    -----Original Message-----
    From: Thilko Richter [mailto:thilko...mx.de]
    Sent: Thursday, May 18, 2006 1:17 PM
    To: cayenne-use..ncubator.apache.org
    Subject: AW: Default domain in cayenne.xml

    Hi Andrus,

    thanks a lot for the quick answer!

    Indeed, it seems that I sent the wrong configuration. I will check this
    issue tomorrow...

    But, would you say it make sense to declare a "default" domain in
    cayenne.xml, in order to get a domain with getDomain() although you have
    configured more than one? Unfortunatly I am not so familar with Cayenne
    concepts ;-)

    Regards,

    Thilko

    -----Ursprüngliche Nachricht-----
    Von: Andrus Adamchik [mailto:andru..bjectstyle.org]
    Gesendet: Donnerstag, 18. Mai 2006 15:54
    An: cayenne-use..ncubator.apache.org
    Cc: Thilko Richter
    Betreff: Re: Default domain in cayenne.xml

    Hi Thilko,

    Generally if you have more than one domain, you have to lookup domain
    by name (there is no default domain concept). However the example
    that you gave has only ONE domain (multiple nodes within domain
    should not result in this error). Could you doublecheck that the
    error is actually generated by this exact cayenne.xml, or is there a
    different version used in runtime?

    Andrus

    P.S. Looks like your address is not subscribed to the list. You may
    want to subscribe to get responses.

    On May 18, 2006, at 9:28 AM, Thilko Richter wrote:

    > Hi everybody,
    >
    >
    > I have specified multiple domains-nodes in my cayenne.xml. When I
    > call getDomain() I get the exception:
    >
    > ...
    > org.objectstyle.cayenne.CayenneRuntimeException: [v.1.2B2 April 17
    > 2006] More than one domain is configured; use 'getDomain(String
    > name)' instead.
    > ...
    >
    >
    > I would like to use getDomain() in my code, is there a way to
    > specify the default domain in the cayenne.xml?
    >
    > For example:
    >
    > <?xml version="1.0" encoding="utf-8"?>
    > <domains project-version="1.1">
    > <domain name="TestDomain">
    > <property name="cayenne.DataDomain.sharedCache" value="true"/>
    > <map name="Sr2DomainMap" location="Sr2DomainMap.map.xml"/>
    >
    > <node name="TestDomainNode1" default="true"
    > datasource="jdbc/dbSr2"
    >
    factory="org.objectstyle.cayenne.conf.JNDIDataSourceFactory">
    > <map-ref name="TestDomainMap"/>
    > </node>
    >
    > <!-- different configured... but not visible here -->
    > <node name="TestDomainNode2"
    > datasource="jdbc/dbSr2"
    >
    factory="org.objectstyle.cayenne.conf.JNDIDataSourceFactory">
    > <map-ref name="TestDomainMap"/>
    > </node>
    > </domain>
    > </domains>
    >
    >
    > thanks in advance!
    >
    >
    > Thilko



    This archive was generated by hypermail 2.0.0 : Thu May 18 2006 - 13:27:42 EDT