R
- cached row typepublic class WriteOperations<R>
extends java.lang.Object
implements java.lang.AutoCloseable
WritableCache.write()
.
The write operations classes are obtained from Cached.insert()
, Cached.update()
,
Cached.delete()
, and Cached.save()
.Constructor and Description |
---|
WriteOperations(WritableCache<R> writableCache)
Constructs for a cache.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes write operations.
|
void |
delete(R row)
Deletes row from database using primary key(s) with
Cached.delete() . |
void |
insert(R row)
Inserts row into database with
Cached.insert() . |
void |
open()
Creates new instances of write operations and initializes them to be used by
insert(Object) ,
update(Object) , delete(Object) , and save(Object) . |
void |
save(R row)
Saves row into database using primary key(s) with
Cached.save() . |
void |
update(R row)
Updates row in database using primary key(s) with
Cached.update() . |
public WriteOperations(WritableCache<R> writableCache) throws CacheException
writableCache
- cache that contains uncommitted rows to writeCacheException
- if errorpublic void open() throws CacheException
insert(Object)
,
update(Object)
, delete(Object)
, and save(Object)
. Caching is turned off
for write operations using SqlOperation.setCached(boolean)
to avoid infinite cache recursion.
Cascading is turned off for write operations with SqlOperation.setCascade(boolean)
since
cascades on cached tables are performed by SqlOperation.execute()
.CacheException
- if errorpublic void close() throws CacheException
close
in interface java.lang.AutoCloseable
CacheException
- if errorpublic void insert(R row) throws CacheException
Cached.insert()
.row
- row to insertCacheException
- if errorpublic void update(R row) throws CacheException
Cached.update()
.row
- row to updateCacheException
- if errorpublic void delete(R row) throws CacheException
Cached.delete()
.row
- row to deleteCacheException
- if errorpublic void save(R row) throws CacheException
Cached.save()
.row
- row to saveCacheException
- if error