cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Wernke zur Borg <w.zurb...@rheagroup.com>
Subject Re: Myslq-Adapter
Date Thu, 15 Mar 2012 14:25:57 GMT

Hi,

after a lot of trouble like yours I found that the easiest way is to set 
the DbAdapter class in the modeler. There is an extra tab "Adapter" on 
the DataNode configuration. You don't need to do anything in your source 
code (except defining your Adapter class).

Wernke


On 2012-03-15 14:19, 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.


-- 
/Wernke zur Borg
*Rhea System S.A.*
Robert-Bosch-Str. 7
64293 Darmstadt / Germany
Tel. +49-6151-8709591/


This email (including any attachments) may contain confidential and/or privileged
information or information otherwise protected from disclosure.  If you are not the
intended recipient, please notify the sender immediately, do not copy this message
or any attachments and do not use it or any purpose or disclose its content to any
person, but delete this message and any attachments from your system.
RHEA System S.A. (RHEA) disclaims any and all liability if this email transmission
was virus corrupted, altered or falsified.

If a Non Disclosure Agreement (NDA) exists between RHEA and the receiving
organization, then all contents shall be considered proprietary and covered under
the NDA.


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message