Custom DbAdapter has been edited by Ari Maniatis (Oct 04, 2007).

(View changes)

Content:

How do I write an adapter to support a database that is not yet supported?

You need to implement a custom DbAdapter. Most likely you won't have to do it from scratch and can extend a JdbcAdapter or one of the existing db-specific adapters.

(Optional) things to do before you start:
  • Open a JIRA issue where all contributed code will go.
  • Subscribe to cayenne-dev, as this is where all Cayenne internals are discussed (those that are of no interest to most users).
Implementation procedure is roughly the following:
  • Check out latest Cayenne source from SVN. If you use Eclipse, follow these instructions to setup the projects.
  • Create a barebone adapter that inherits from JdbcAdapter.
It is a good idea to put all new adapter code in its own Java package, e.g. org.apache.cayenne.dba.mydb, as default resource loading depends on that.
  • Copy types.xml file from org.apache.cayenne.dba package and edit it to map standard JDBC types to the target database native types.
Correct mapping is needed for the Modeler to do schema generation. Techically it is not required for the runtime. However types.xml should still be there.
  • Run existing Cayenne unit tests with the new adapter, analyze the failures and change adapter code accordingly.
  • Repeat the last step until all tests pass.
  • Report success in JIRA and cayenne-devel - one of the committers will integrate your code to Cayenne.

Reply via email to