On 20 mar 2008, at 10.19, Marcin Skladaniec wrote:

I might be wrong, but why you just create the Basket and the relationship to Book and don't commit the context until the user logs in ? :

on adding item:
Basket row = _context.newObject(Basket.class);
row.addToBooks(someBook);

on successful login:
row.setUser(someUser);
_context.commitChanges();

If you need to store the selected Basket items before the user logs in, to allow the user to quit shopping and return later you can do that using isbn(s) and cookie(s).

Maybe I was unclear. BASKET reflects a read/write database where I
store my basket rows. But BOOKS is on a second database server
(read-only) and i.e. holds the correlation isbn->title.

All I want to do is to not store 'title' in basket but have cayenne
fetch it (preferable lazy) when I need to display the content of
the shopping basket. I.e. at the time I add a row to the basket in
my web project, I only have the isbn, nothing else.

/Andreas Pardeike

Reply via email to