postgresql serial columns and wonder
postgresql serial columns and wonder
- Subject: postgresql serial columns and wonder
- From: Theodore Petrosky <email@hidden>
- Date: Sat, 17 Apr 2010 19:49:32 -0700 (PDT)
I want to expose the primary key to be part of my entity. (At least this is what I think I want.)
I have a Job entity. Each job has a number. I am using a setval in my migrations to make the primary key start at a given number and I want to use this number as the job number. So far so good. I want to show this value in a column of a table. However, if I expose the key by making it a class property, my Job.createJob accessor is expecting that I supply the integer for the primary key...
So I tried to create a second attribute that is a serial column. When I insert directly into the table (from psql) the serial is inserted automatically. However if I insert from my app, the app overwrites the column with a null.
so,
Do I want to use the primary key?
if yes, can I expose reading it from my entity (myJob.id or the serial column myJob.jobNumber)
if no... what are others doing... my situation cannot be unique!
If I were writing a cocoa app., I would create a view in the table and all my queries would be against the view. I started thinking maybe this is what I want here.
Ted
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden