diff options
author | Brian S. O'Neill <bronee@gmail.com> | 2006-10-17 23:32:59 +0000 |
---|---|---|
committer | Brian S. O'Neill <bronee@gmail.com> | 2006-10-17 23:32:59 +0000 |
commit | 30cc7f1c3943be87573849864f1f0637fd5cc3c6 (patch) | |
tree | af8c1e479d97bed96eb28e6fc55358f48c71fa74 /src/main/java/com/amazon/carbonado/spi | |
parent | 987e5b79304062308a5d304a57dabcce97654867 (diff) |
Prevent accidental replication of internal storables.
Diffstat (limited to 'src/main/java/com/amazon/carbonado/spi')
-rw-r--r-- | src/main/java/com/amazon/carbonado/spi/LobEngine.java | 5 | ||||
-rw-r--r-- | src/main/java/com/amazon/carbonado/spi/StoredLob.java | 9 | ||||
-rw-r--r-- | src/main/java/com/amazon/carbonado/spi/StoredSequence.java | 2 |
3 files changed, 9 insertions, 7 deletions
diff --git a/src/main/java/com/amazon/carbonado/spi/LobEngine.java b/src/main/java/com/amazon/carbonado/spi/LobEngine.java index 167c5b1..e91bf59 100644 --- a/src/main/java/com/amazon/carbonado/spi/LobEngine.java +++ b/src/main/java/com/amazon/carbonado/spi/LobEngine.java @@ -149,7 +149,7 @@ public class LobEngine { lob.setLocator(locator);
if (lob.tryDelete()) {
try {
- lob.getBlocks().deleteAll();
+ mLobBlockStorage.query("locator = ?").with(lob.getLocator()).deleteAll();
} catch (FetchException e) {
throw e.toPersistException();
}
@@ -579,7 +579,8 @@ public class LobEngine { // Free unused blocks.
long newBlockCount = lob.getBlockCount();
if (newBlockCount < oldBlockCount) {
- lob.getBlocks().and("blockNumber >= ?")
+ mLobBlockStorage.query("locator = ? & blockNumber >= ?")
+ .with(lob.getLocator())
// Subtract 0x80000000 such that block zero is
// physically stored with the smallest integer.
.with(((int) newBlockCount) - 0x80000000)
diff --git a/src/main/java/com/amazon/carbonado/spi/StoredLob.java b/src/main/java/com/amazon/carbonado/spi/StoredLob.java index e081bb3..2435cb1 100644 --- a/src/main/java/com/amazon/carbonado/spi/StoredLob.java +++ b/src/main/java/com/amazon/carbonado/spi/StoredLob.java @@ -18,10 +18,10 @@ package com.amazon.carbonado.spi;
+import com.amazon.carbonado.Alias;
import com.amazon.carbonado.FetchException;
-import com.amazon.carbonado.Join;
+import com.amazon.carbonado.Independent;
import com.amazon.carbonado.PrimaryKey;
-import com.amazon.carbonado.Query;
import com.amazon.carbonado.Sequence;
import com.amazon.carbonado.Storable;
import com.amazon.carbonado.Version;
@@ -35,6 +35,8 @@ import com.amazon.carbonado.constraint.IntegerConstraint; * @see LobEngine
*/
@PrimaryKey("locator")
+@Independent
+@Alias("CARBONADO_LOB")
public abstract class StoredLob implements Storable<StoredLob> {
@Sequence("com.amazon.carbonado.spi.StoredLob")
public abstract long getLocator();
@@ -52,9 +54,6 @@ public abstract class StoredLob implements Storable<StoredLob> { public abstract int getVersion();
public abstract void setVersion(int version);
- @Join
- public abstract Query<Block> getBlocks() throws FetchException;
-
/**
* Returns number of blocks required to store Lob.
*/
diff --git a/src/main/java/com/amazon/carbonado/spi/StoredSequence.java b/src/main/java/com/amazon/carbonado/spi/StoredSequence.java index bcd0a3c..0a5a19e 100644 --- a/src/main/java/com/amazon/carbonado/spi/StoredSequence.java +++ b/src/main/java/com/amazon/carbonado/spi/StoredSequence.java @@ -19,6 +19,7 @@ package com.amazon.carbonado.spi;
import com.amazon.carbonado.Alias;
+import com.amazon.carbonado.Independent;
import com.amazon.carbonado.PrimaryKey;
import com.amazon.carbonado.Storable;
@@ -28,6 +29,7 @@ import com.amazon.carbonado.Storable; * @author Brian S O'Neill
*/
@PrimaryKey("name")
+@Independent
@Alias("CARBONADO_SEQUENCE")
public interface StoredSequence extends Storable<StoredSequence> {
String getName();
|