Re: postgresql serial columns and wonder
Re: postgresql serial columns and wonder
- Subject: Re: postgresql serial columns and wonder
- From: Kieran Kelleher <email@hidden>
- Date: Sun, 18 Apr 2010 02:42:32 -0400
Alternative suggestion:
A readonly derived column is another option to expose the PK. The advantage is that the the new exposed column can be used in standard EOQualifier that works in memory and for schema-based qualifiers.
Assuming your primary key col is named "pk" and you want an attribute named "jobcode" that exposes the "pk"...
attribute: jobcode
derived: √
read-only: √
definition: (pk) [Note: if mapping a column name to a "derived" attribute, you must surround it in brackets, otherwise EOF cannot parse it]
On Apr 17, 2010, at 11:44 PM, Theodore Petrosky wrote:
> Thank you.... primaryKey() is working for my needs. I didn't want to do a separate query... I have a couple of relations and I eventually wanted a string that was something like:
>
> <td><wo:WOString value = "$current.client.clientCode"/>-<wo:WOString value = "$current.products.productCode"/>-<wo:WOString value = "$current.primaryKey" /></td>
> so I end up with a display of:
>
> MRK-M-1001
>
> I just tested this and it is perfect...
>
> Ted
>
>
>
> --- On Sat, 4/17/10, Guido Neitzer <email@hidden> wrote:
>
>> From: Guido Neitzer <email@hidden>
>> Subject: Re: postgresql serial columns and wonder
>> To: "WebObjects-Dev Mailing List List" <email@hidden>
>> Cc: "Theodore Petrosky" <email@hidden>
>> Date: Saturday, April 17, 2010, 11:12 PM
>> On 17. Apr, 2010, at 19:49 , Theodore
>> Petrosky wrote:
>>
>>> I want to expose the primary key to be part of my
>> entity. (At least this is what I think I want.)
>>
>> Maybe you want this, but is it what you need? I'd say, you
>> have several options:
>>
>> In awakeFromInsertion you could query (probably just raw
>> sql) a specific "jobnumber_sequence" in the DB and populate
>> the job number with that value.
>>
>> If you only use this for display purpose, you could use
>> "primaryKey()" which gives you the primary key of the row.
>> If you call "primaryKeyInTransaction" Wonder will query the
>> database for a pk for a newly created object and you can
>> display this.
>>
>> Personally, I'd use a separate sequence that is independent
>> of the pk.
>>
>> cug
>
>
>
> _______________________________________________
> 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
_______________________________________________
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