| Title: DbAdapter |
| |
| <H3><A name="DbAdapter-PortabilityAcrossDatabases"></A>Portability Across Databases</H3> |
| |
| <P>The JDBC specification provides a great abstraction for relational database work. Still in practice some cross-database portability issues remain:</P> |
| |
| <UL> |
| <LI>Certain standard SQL features may not be implemented in some RDBMS.</LI> |
| <LI>Certain standard JDBC features may not be supported by some drivers (batch updates, auto incremented columns, etc.)</LI> |
| <LI>SQL syntax may vary across RDBMS.</LI> |
| <LI>BLOBs and CLOBs are handled differently by different vendors.</LI> |
| <LI>Data type definitions vary across RDBMS. Data types may have different names, size and precision.</LI> |
| <LI>Vendors provide their own extensions of SQL and JDBC functionality. Taking advantage of these extensions and creating portable code at the same time is not a trivial task.</LI> |
| </UL> |
| |
| |
| <P><TT>org.apache.cayenne.dba.DbAdapter</TT> interface is used in Cayenne for an additional portability layer sitting on top of JDBC. There is one generic implementation of DbAdapter provided with Cayenne (JdbcAdapter) and also a subclass of JdbcAdapter for each database that is officially supported by Cayenne. Users can create their own adapter implementations as well (some hints are given <A href="custom-dbadapter.html" title="Custom DbAdapter">here</A>).</P> |
| |
| <H3><A name="DbAdapter-DbAdapterAutomaticDetection"></A>DbAdapter Automatic Detection</H3> |
| |
| <P>Usually Cayenne detects the type of the database dynamically and installs the right adapter in runtime. However a user can enforce a specific adapter class by entering its name using "Adapter" tab in the DataNode Editor panel in CayenneModeler. Alternatively an adapter can be set on a DataNode via a method call.</P> |
| |