|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface CompassIndexSession
A specialized interface that provides only index capabilities.
Using the session depends on how transaction managemnet should be done (also see
Compass.openSession(). The simplest form looks like this:
CompassIndexSession session = compass.openIndexSession();
try {
// do operations with the session
session.commit(); // same as session.close()
} catch (Exception e) {
session.rollback();
} finally {
session.close();
}
| Method Summary | |
|---|---|
void |
close()
Closes the CompassSession. |
void |
commit()
Same as CompassSession.close(). |
void |
create(Object obj)
Creates a NEW object in Compass. |
void |
create(String alias,
Object obj)
Creates a NEW object in Compass that shares mapping alais with multiple objects. |
void |
delete(Class clazz,
Object... ids)
Deletes an object from Compass that match the mapping specified for the defined class based on its ids. |
void |
delete(Class clazz,
Object obj)
Deletes an object from Compass that match the mapping specified for the defined class. |
void |
delete(CompassQuery query)
Deletes all entries in the index that match the given query. |
void |
delete(Object obj)
Deletes an object from Compass. |
void |
delete(Resource resource)
Deletes a resource with the specified alias. |
void |
delete(String alias,
Object... ids)
Deletes an object from Compass with multiple alias's based on its ids. |
void |
delete(String alias,
Object obj)
Deletes an object from Compass with multiple alias's. |
void |
flush()
Flush the current transaction. |
void |
flushCommit(String... aliases)
Flush commit all the provided aliases (or all of them, if none is provided). |
CompassSettings |
getSettings()
Runtimes settings that apply on the session level. |
boolean |
isClosed()
Returns true if the session is closed. |
ResourceFactory |
resourceFactory()
Returns a resource factory allowing to create resources and properties. |
void |
rollback()
When not using explicit CompassTransaction in order to manage transactions, can be called
to rollback the current running transaction. |
void |
save(Object obj)
Saves an object in Compass. |
void |
save(String alias,
Object obj)
Saves an object in Compass that shares mapping alais with multiple objects. |
| Method Detail |
|---|
CompassSettings getSettings()
ResourceFactory resourceFactory()
void flush()
throws CompassException
CompassException
void flushCommit(String... aliases)
throws CompassException
CompassException
void delete(Resource resource)
throws CompassException
resource - The resource to be deleted.
CompassException
void delete(Object obj)
throws CompassException
obj - The object to delete
CompassException
void delete(String alias,
Object obj)
throws CompassException
alias - The alias that the objects maps underobj - The object to delete
CompassException
void delete(String alias,
Object... ids)
throws CompassException
alias - The alias that the objects maps underids - The ids of the object to delete
CompassException
void delete(Class clazz,
Object obj)
throws CompassException
clazz - The class that represtents the required mappingobj - The object to delete
CompassException
void delete(Class clazz,
Object... ids)
throws CompassException
clazz - The class that represtents the required mappingids - The object ids to delete
CompassException
void delete(CompassQuery query)
throws CompassException
query - The query to delete by
CompassException
void create(Object obj)
throws CompassException
obj - The object to save.
CompassException
void create(String alias,
Object obj)
throws CompassException
alias - The alias that match the object mappingsobj - The object to save
CompassException
void save(Object obj)
throws CompassException
obj - The object to save.
CompassException
void save(String alias,
Object obj)
throws CompassException
alias - The alias that match the object mappingsobj - The object to save
CompassException
void rollback()
throws CompassException
CompassTransaction in order to manage transactions, can be called
to rollback the current running transaction. Effectively also closes the session.
CompassException
void commit()
throws CompassException
CompassSession.close().
CompassException
void close()
throws CompassException
If there is an on going transaction associated with the session that has not been committed / rolledback yet, will commit the transaction (and in case of failure, will roll it back). Failed commits will throw an exception from the close method.
CompassExceptionCompass.openSession()boolean isClosed()
true if the session is closed. Note, if this session
"joined" another session, it won't actually be closed, and defer closing
the session to the outer session.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||