cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrus Adamchik <and...@objectstyle.org>
Subject Re: Myslq-Adapter
Date Thu, 15 Mar 2012 13:33:49 GMT
NPE is for JdbcEventLogger in the DataNode, not related to adapter.

check DataDomainProvider.createAndInitDataDomain for how the DataNode is created. Specifically
JdbcEventLogger is set explicitly:

dataNode.setJdbcEventLogger(jdbcEventLogger);

Andrus

On Mar 15, 2012, at 9:19 AM, Sheldon wrote:

> Hello,
> how can I create a custom Mysql adapter? I use cayenne 3.1M3. 
> 
> I've tried:
> 
> 1) 
> DataNode node = new DataNode(...);
> dataNode.setAdapter(new MySQLAdapter());
> 
> 2)
> Provider<DbAdapter> adapterProvider = new Provider<DbAdapter>() {
> 
> 		public DbAdapter get() throws ConfigurationException {
> 			MySQLAdapter adapter = new MySQLAdapter();
> 		        return adapter;
> 		}
> };
> AutoAdapter autoAdapter = new AutoAdapter(adapterProvider, logger);
> 
> --------------------------------
> 
> everytime I get following Exception:
> Exception in thread "main" org.apache.cayenne.CayenneRuntimeException:
> [v.3.1M3 Sep 12 2011 19:59:45] java.lang.NullPointerException
> 	at
> org.apache.cayenne.access.DataDomain.runInTransaction(DataDomain.java:840)
> 	at
> org.apache.cayenne.access.DataDomainQueryAction.runQueryInTransaction(DataDomainQueryAction.java:392)
> 	at
> org.apache.cayenne.access.DataDomainQueryAction.execute(DataDomainQueryAction.java:121)
> 	at
> org.apache.cayenne.access.DataDomain.onQueryNoFilters(DataDomain.java:708)
> 	at
> org.apache.cayenne.access.DataDomain$DataDomainQueryFilterChain.onQuery(DataDomain.java:958)
> 	at org.apache.cayenne.access.DataDomain.onQuery(DataDomain.java:698)
> 	at
> org.apache.cayenne.util.ObjectContextQueryAction.runQuery(ObjectContextQueryAction.java:336)
> 	at
> org.apache.cayenne.util.ObjectContextQueryAction.executePostCache(ObjectContextQueryAction.java:104)
> 	at
> org.apache.cayenne.util.ObjectContextQueryAction.execute(ObjectContextQueryAction.java:91)
> 	at org.apache.cayenne.access.DataContext.onQuery(DataContext.java:990)
> 	at org.apache.cayenne.access.DataContext.performQuery(DataContext.java:979)
> 	at
> org.example.cayenne.persistent.DynamicMain.selectTutorial(DynamicMain.java:271)
> 	at org.example.cayenne.persistent.DynamicMain.main(DynamicMain.java:252)
> Caused by: java.lang.NullPointerException
> 	at org.apache.cayenne.access.DataNode.performQueries(DataNode.java:281)
> 	at
> org.apache.cayenne.access.DataDomainQueryAction.runQuery(DataDomainQueryAction.java:422)
> 	at
> org.apache.cayenne.access.DataDomainQueryAction.access$000(DataDomainQueryAction.java:69)
> 	at
> org.apache.cayenne.access.DataDomainQueryAction$2.transform(DataDomainQueryAction.java:395)
> 	at
> org.apache.cayenne.access.DataDomain.runInTransaction(DataDomain.java:828)
> 	... 12 more
> 
> best regards
> 
> --
> View this message in context: http://cayenne.195.n3.nabble.com/Myslq-Adapter-tp3828735p3828735.html
> Sent from the Cayenne - User mailing list archive at Nabble.com.
> 


Mime
View raw message