cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kevin Meyer - KMZ" <ke...@kmz.co.za>
Subject Re: Is it possible/easy to integrate cayenne with other frameworks?
Date Mon, 12 Dec 2011 18:09:34 GMT
I don't believe that I am creating a DataNode...where does this fit in?

My initialisation currently looks like:
        IsisPropertiesModule pm = new IsisPropertiesModule();
        runtime = new ServerRuntime("cayenne-project.xml", pm);
        context = runtime.getContext();

        dataContext = (DataContext) context;

        final EntityResolver entityResolver = dataContext.getEntityResolver();
        dataMap = entityResolver.getDataMap("isis_map");
        if (dataMap == null) {
            dataMap = new DataMap("isis_map");
            entityResolver.addDataMap(dataMap);
        }

where IsisPropertiesModule was an attempt to add a property fetcher 
from the properties file:

    public void configure(Binder binder) {
        MapBuilder<Object> mapBuilder = binder.bindMap(DefaultRuntimeProperties.PROPERTIES_MAP);
        Properties props = new Properties();

        props.put("cayenne.jdbc.driver", "org.hsqldb.jdbcDriver");
        props.put("cayenne.jdbc.connection", "jdbc:hsqldb:file:hsql-db/tests");
        props.put("cayenne.jdbc.user", "sa");
        props.put("cayenne.jdbc.password", "");

        for (Object keyObj : props.keySet()) {
            String key = (String) keyObj;
            mapBuilder.put(key, props.get(key));
        }
    }

but it doesn't have any effect.

My "empty" cayenne-project.xml contains:
<?xml version="1.0" encoding="utf-8"?>
<domain project-version="6">
	<map name="datamap"/>
	<node name="datanode"
		 factory="org.apache.cayenne.configuration.server.XMLPoolingDataSourceFactory"
		 schema-update-strategy="org.apache.cayenne.access.dbsync.CreateIfNoSchemaStrategy"
		>
		<!-- <map-ref name="datamap"/> --> 
		<data-source>
			<driver value="org.hsqldb.jdbcDriver"/>
			<url value="jdbc:hsqldb:file:hsql-db/tests"/>
			<connectionPool min="1" max="10"/>
			<login userName="sa"/>
		</data-source>
	</node>
</domain>
 
I would like to not have to have this xml file, and reproduce everything 
programmatically.

Regards,
Kevin


On 12 Dec 2011 at 12:02, Mike Kienenberger wrote:

> How are you creating a DataNode and what are you doing to assign DataMaps to it?
> 
> On Mon, Dec 12, 2011 at 11:52 AM, Kevin Meyer - KMZ <kevin@kmz.co.za> wrote:
> > Ok, thanks, I call
> >            objAttribute.setDbAttributePath(id);
> > and I am now back to my previous problem, where
> >        DataNode node =
> > parent.getDomain().lookupDataNode(entity.getDataMap());
> > has node == null in DataDomainInsertBucket#createPermIds.
> >
> > Any hints?
> >


Mime
View raw message