FAQ
Hi,

I am using cayenne-server-3.0M1. In my application, there is multiple
dataMaps for a dataDomain.
How can I register an object?

I tried

CmsText cmsText = new CmsText();
context.registerNewObject(cmsText);

But it gives the following exception:

java.lang.IllegalArgumentException: Can't find ObjEntity for DataObject
class: com.foo.window.text.model.CmsText, class is likely not mapped.
at
org.apache.cayenne.access.DataContext.registerNewObject(DataContext.java:810)


Regards,
James
--
View this message in context: http://www.nabble.com/Register-object-in-multiple-dataMaps-environment-tp14319433p14319433.html
Sent from the Cayenne - User mailing list archive at Nabble.com.

Search Discussions

  • James yong at Dec 14, 2007 at 3:42 pm
    Each of the dataMaps come from a different cayenne.xml file, like the example
    given in

    http://www.nabble.com/Best-practices-question-td13040821.html#a13040821
    http://www.nabble.com/Best-practices-question-td13040821.html#a13040821

    --
    View this message in context: http://www.nabble.com/Register-object-in-multiple-dataMaps-environment-tp14319433p14338213.html
    Sent from the Cayenne - User mailing list archive at Nabble.com.
  • Andrus Adamchik at Dec 17, 2007 at 8:55 am
    Hi there,

    Per you second message, this is more of a multiple cayenne.xml
    environment...

    So is the intention to access multiple DataMaps via a single
    DataContext? If so you the simplest thing would be to combine all
    mappings in a single project with one cayenne.xml. If this is not an
    option, you can load extra DataMaps with MapLoader class and merge
    them to the root domain in runtime.


    DataDomain domain =
    Configuration.getSharedConfiguration().getDomain();
    DataMap map = new MapLoader().loadDataMap(new InputSource("path/to/
    datamap"));
    domain.addMap(map);

    Iterator it = domain.getDataNodes().iterator();
    while (dataNodeIterator.hasNext()) {
    DataNode node = (DataNode) it.next();
    node.addDataMap(map);
    }


    Andrus

    P.S. We *really* need to make it seamless in Cayenne... I'll add it to
    my long todo list...

    On Dec 13, 2007, at 6:32 PM, james yong wrote:
    Hi,

    I am using cayenne-server-3.0M1. In my application, there is multiple
    dataMaps for a dataDomain.
    How can I register an object?

    I tried

    CmsText cmsText = new CmsText();
    context.registerNewObject(cmsText);

    But it gives the following exception:

    java.lang.IllegalArgumentException: Can't find ObjEntity for
    DataObject
    class: com.foo.window.text.model.CmsText, class is likely not mapped.
    at
    org
    .apache
    .cayenne.access.DataContext.registerNewObject(DataContext.java:810)


    Regards,
    James
    --
    View this message in context: http://www.nabble.com/Register-object-in-multiple-dataMaps-environment-tp14319433p14319433.html
    Sent from the Cayenne - User mailing list archive at Nabble.com.
  • James yong at Dec 17, 2007 at 3:13 pm
    Hi,

    For my case, I found that the className attribute is not set correct in my
    datamap xml file, thus causing the error.

    Thanks.
    --
    View this message in context: http://www.nabble.com/Register-object-in-multiple-dataMaps-environment-tp14319433p14372432.html
    Sent from the Cayenne - User mailing list archive at Nabble.com.
  • Andrus Adamchik at Dec 17, 2007 at 3:25 pm
    Yeah, that's a much simpler explanation :-)

    Andrus
    On Dec 17, 2007, at 5:12 PM, james yong wrote:


    Hi,

    For my case, I found that the className attribute is not set correct
    in my
    datamap xml file, thus causing the error.

    Thanks.
    --
    View this message in context: http://www.nabble.com/Register-object-in-multiple-dataMaps-environment-tp14319433p14372432.html
    Sent from the Cayenne - User mailing list archive at Nabble.com.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupuser @
categoriescayenne
postedDec 13, '07 at 4:32p
activeDec 17, '07 at 3:25p
posts5
users2
websitecayenne.apache.org

2 users in discussion

James yong: 3 posts Andrus Adamchik: 2 posts

People

Translate

site design / logo © 2022 Grokbase