Thanks everyone. This is definitely making me feel more comfortable with
Cayenne as an ORM choice. For #2 (PK Generation) below, does that mean I
have to roll my own generator? Is there more detailed documentation on
that (don't see it on the website)?
Thanks again.
-Mike
From:
Andrus Adamchik <
[email protected]>
To:
[email protected]Date:
03/24/2010 08:16 AM
Subject:
Re: Switching databases
Cayenne project mapping is close to a 100% portable between different
DB's as long as the DB's themselves are compatible. I guess the only
piece that will need to change is DataNode connection info (and this
can be delegated to container by using JNDI node).
Now specific items:
1. DbAdapter:
Analog of Hibernate's dialect in Cayenne is DbAdapter. Cayenne has
auto-detection of the DB type, so the correct DbAdapter is installed
automatically. No need to change anything.
2. PK generation:
Auto ID generation mechanism may differ between DBs. It has to be
installed on the target DB either manually before starting the app, or
with some simple Cayenne code using DbGenerator class on startup. In
any event, the differences between DB's are still abstracted and won't
require mapping changes. E.g. for Oracle DbGenerator will create PK
sequences, while for MySQL - a PK lookup table.
3. Stored procedures:
generally mappings should be portable, however different DB's may have
incompatible formats for handling in/out parameters and returned
result sets. So let's look at specific cases for me to comment more
intelligently.
Hope this helps.
Andrus
On Mar 23, 2010, at 8:40 PM, [email protected] wrote:Hi,
I'm looking into using Cayenne as a backend ORM technology
replacing hibernate. Currently our product supports multiple DBMSes
(SQL
Server, Oracle, DB2) depending on what the client already has
installed.
In hibernate when switching between oracle and sql server, for
example, is
just a matter of changing the dialect. Is there a recommended way in
Cayenne to generate models in a generic way so that the backend DBMS
can
be swapped out in code? (How is auto id generation effected? How are
stored procs. handled? etc.) I only see articles related to running
across multiple DBMSes.
Thanks.
-Mike