cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hugi Thordarson <h...@karlmenn.is>
Subject Sharing a database with EOF: Primary key generation
Date Fri, 22 May 2015 10:33:25 GMT
Hi again.

I’m using EOF and Cayenne to talk to the same MySQL database. Works fine apart from one
problem: Primary key generation.

Cayenne and EOF use a similar method, i.e. a table for the primary keys, but there’s an
implementation difference — EOF stores the *last* primary key value provided while Cayenne
stores the *next* value to be used. This means they can’t share a single table (by using
a view for the naming differences).

Anyone have any brilliant ideas or workarounds for this? (before I start messing around with
triggers or other messy workarounds).

On the subject of PK generation, there’s one thing I really like in EOF; if the PK table
is missing a row for a table, EOF will automatically select the max() value of the table's
PK column and use it to populate the table. Quite useful. Any objections to this becoming
a feature in Cayenne as well? (via pull request)

Cheers,
- hugi

PS: Sorry for spamming the list with my stupid questions these days: hopefully I’ll be able
to contribute in a meaningful way soon, rather than just sucking at the teat of your knowledge
:).

// Hugi Thordarson
// http://www.loftfar.is/ <http://www.loftfar.is/>
// s. 895-6688
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message