Hi,

I'm working with LCDS' Data Services and I have a question regarding a
particular use case:

Imagine I'm using Data Services' Java Assembler-VO architecture to
build a grocery store inventory application.  I've got a datagrid
displaying all the products stored in a product table in my MYSQL db.  

Say each product record in the DB has a unique productID (Imagine a
barcode number), a product description, and a quantity.   

The way productID's are generated is by having the DB auto_increment
the productID field upon insertion of a new record (the creation of a
new product type).

Now, on the Data Services side of this I have my DB-Assembler mapping
configured to use the productID field as the unique key when managing
my Java/Actionscript value objects. 

Now normally when I want to create a new record in MYSQL with a
primary key that is set to auto_increment, I just supply a static
placeholder number as that primary key and MYSQL automatically
replaces it with the correct index.


Now, if I want to allow the user to create a new product record my
Assembler requires that I supply a new actionscript VO with a
productID Unique to the records that its managing.  

This is bothering me because I would need to either loop through the
items in my local array and find the next productID (with the
possibility of a synchronization error) or query the DB to find out
what the next productID should be before instantiating a new product
VO and committing it to the assembler.

The big catch-22 in this is that I can construct my assembler to
insert a new Product record into the DB and I can have it find out
what the db set the productID to and return that to the user but in
order to create a new record, Data Services requires that the flex-end
submits a well-formed(with a unique productID) VO to the assembler for
creation.  

Reply via email to