summaryrefslogtreecommitdiff
path: root/src/main/java/com/amazon/carbonado/spi
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/amazon/carbonado/spi')
-rw-r--r--src/main/java/com/amazon/carbonado/spi/LobEngine.java5
-rw-r--r--src/main/java/com/amazon/carbonado/spi/StoredLob.java9
-rw-r--r--src/main/java/com/amazon/carbonado/spi/StoredSequence.java2
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();