Sorry if this a very basic question, but I dont know what is the best way to solve it.
I am developening a system that register and updates users:
Someone enters data in one form...if this data corrsponds to an existing user, it updates the row if not it cretes a new row entry in DB.
The question is..Cayenne manages by itself the Pk, so: how can indicate Cayenne that it must check for another field (i.e.: userAlias) in order to recognize if this data belongs to an existing user that must be updated or a new one to be added?
Must I make a select query trying to find this 'userAlias'?...then if this object exists...get it using "DataContext.objectFromDataRow()"...update the field and commit changes...
Or if it doesn't exist...dataContext.createAndRegisterNewObject("User")...set its attributes and commit changes.
Is this the correct aproach...or there is a simpler way to get this behaviour?
Thx. in advance.
---------------------------------
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
This archive was generated by hypermail 2.0.0 : Tue Aug 12 2003 - 09:03:57 EDT