Re: Unique ID without create entity?
Re: Unique ID without create entity?
- Subject: Re: Unique ID without create entity?
- From: Guido Neitzer <email@hidden>
- Date: Sat, 4 Oct 2008 00:04:22 -0600
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