Re: Unique ID without create entity?
Re: Unique ID without create entity?
- Subject: Re: Unique ID without create entity?
- From: "Yung-Luen Lan" <email@hidden>
- Date: Sat, 4 Oct 2008 16:11:11 +0800
Thanks for your suggestion. Could you elaborate more? Why is using PK
considered as a bad style?
Regards,
yllan
On 10/4/08, Guido Neitzer <email@hidden> wrote:
> On 03.10.2008, at 23:55, Yung-Luen Lan wrote:
>
>> I'm now connect my wo app to 3rd party banking service. According to
>> their API, I need to provide a "transaction id" that is unique for
>> each transaction or I'll get error.
>>
>> Sure, it can be done by creating an entity class and use PK as a
>> unique id. But I don't want to create the entity class since I don't
>> need that.
>>
>> What I want is just like this:
>>
>> SELECT nextval('serial');
>>
>> Can I do this in webobjects?
>
> You can, but I'd think really hard about not making an entity. What
> I'd do is creating a Transaction entity and a sequence in the
> database, populate an attribute of a new transaction with a value from
> the sequence (look at EOUtilities.rawRowsForSQL to see how to use the
> direct SQL) and store that transaction in the database - update it
> with status, log, whatever information you get from the banking
> service. Make the transaction id column unique in the database too,
> but don't use the primary key (that is considered bad style).
>
> Just as a friendly advise ...
>
> cug
>
> --
> Real World WebObjects Bootcamp at the Big Nerd Ranch:
> http://www.bignerdranch.com/classes/real-world_webobjects.shtml
>
>
_______________________________________________
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