[web-devel] [Database.Persistent] Custom Id field

Michael Snoyman michael at snoyman.com
Sun Oct 23 11:29:40 CEST 2011


On Sat, Oct 22, 2011 at 10:22 AM, Konstantin Litvinenko
<to.darkangel at gmail.com> wrote:
> Hi All.
>
> I want to access database in a project where almost all objects has primary
> keys named idx, not Id. How can I define persistent object with key idx not
> Id? Another problem is that idx is not serial, just integer, and must be set
> explicitly. Is persistent capable for such tasks?

For now, it looks like the Persistent codebase hardcodes the field to
be "id". That should be fairly easy to change. The harder bit is
dealing with the fact that it needs to be set explicitly. That means
you won't be able to use the "insert" function at all, but everything
else should (in theory) work.

Michael



More information about the web-devel mailing list