db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marco Schulze <Ma...@NightLabs.de>
Subject Re: makePersistent detached instance deleted on database
Date Thu, 09 Mar 2006 17:44:29 GMT
Craig L Russell wrote:
> Hi Jörg,
> There are no tests planned for this behavior.
> The issue is that it violates the contract of detachment. Detachment  
> is intended to provide a "long-running optimistic transaction" in  
> which conflicts are detected in a subsequent transaction.
> If an instance is detached and then the underlying datastore instance  
> is deleted, this is a consistency violation that should be detected  
> by the transaction semantics. For example, in an order system, if a  
> customer is in a long-running transaction with "groovy beads" in the  
> shopping cart, and the administrators decide that "groovy beads" are  
> no longer to be sold, you want the order that contains "groovy beads"  
> to be rejected when the shopping cart arrives at checkout. You don't  
> want that order to reinsert "groovy beads" into the database.
> Craig
Hello Craig,

I agree that there are use cases where this kind of datastore-protection 
makes sense. But unfortunately this behaviour prevents working with more 
than one datastore (or at least makes it VERY complicated). Thus, it's 
IMHO a question of weighing which feature is more important.

For us it's essential to work with many datastores and to easily copy 
complex object graphs between them. Your use case actually exists in our 
system, too. But the object "groovy beads" must not be deleted from the 
datastore anymore after it has been "published" once, because the object 
already has an important history at that time (e.g. the fact who has 
published it when and who has decided when to take it off the 
catalogue). Though this is only application specific and my personal 
background, I still think that the case you described is more seldom 
than data replication and it's easier to work-around.

There would be another possibility: Give each datastore a unique ID 
(autogenerate it during creation/initialization of the datastore) and 
have the consistency-protection only active when you try to persist an 
object graph that was detached from exactly the same datastore.

Best regards, Marco :-)
Initiative baden-württembergischer Unternehmen
gegen Patentierbarkeit von Software
*** http://bw-gegen-softwarepatente.de ***
Marco Schulze                   NightLabs GmbH
                                Rehlingstr. 6d
                                79100 Freiburg

eMail:  Marco@NightLabs.de
Fon:    +49-761-2 111 793
Mobile: +49-172-212 63 80
Fax:    +49-761-2 111 798
WWW:    http://www.NightLabs.de

  Marco Schulze <Marco@NightLabs.de>
  Niklas Schiffler <Nick@NightLabs.de>

  Amtsgericht Freiburg, HRB 6186

View raw message