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.



Reply via email to