public interface RemoteStore extends Remote
Many methods contain a condition string. The syntax of them is as in an SQL where clause like "name='john' and salary > 1000", where name and salary are database fields of the given object class. In methods where the extra parameter bindVars appears, the condition can contain placeholders, for example "name=? and salary >?".
The condition parameter may always be null, as well as the order parameter. The bindVars may be null if no placeholders are used in the condition.
Modifier and Type | Method and Description |
---|---|
void |
checkUnique(Persistent o)
This method throws an
ApplicationException if a duplicate of the given object is in the database. |
int |
count(Class<?> c,
String cond,
Object... bindVars)
This method returns the number of members of a given class matching the given condition.
|
int |
count(String classname,
String cond,
Object... bindVars)
This method returns the number of members of a given class matching the given condition.
|
int |
delete(Class<?> c,
String condition,
Object... bindVars)
Deletes some objects from the database.
|
int |
delete(Collection<?> collection)
Deletes the objects of the collection from the database.
|
int |
delete(Persistent o)
Deletes the object from the database.
|
int |
delete(String classname,
String condition,
Object... bindVars)
Deletes some objects from the database.
|
int |
executeStatement(String stmt)
Execute a SQL statement.
|
int |
executeStatement(String stmt,
Object... bindVars)
Execute a SQL statement.
|
<P extends Persistent> |
fill(List<P> l)
Fills the objects within list l.
|
<P> P |
fill(P o)
Fill objects where only the oid is set.
|
<P extends Persistent,R extends Persistent> |
fillByField(Class<? extends P> c,
Collection<R> collection,
String fieldname)
Fill a heterogeneous set of Persistents referenced via a field of a collection of (persistent) objects.
|
<P extends Persistent,R extends Persistent> |
fillByField(Class<? extends P> c,
Collection<R> collection,
String fieldname,
String cond,
Object... bindVars)
Fill a heterogeneous set of Persistents referenced via a field of a collection of (persistent) objects.
|
<P extends Persistent> |
fillByFields(Collection<P> collection,
String fieldNames)
Fetches dependent objects of a collection of Persistents reachable via the specified fields.
|
<P> P |
get(Class<? extends P> c,
long oid)
Method for getting objects from the database.
|
<P> P |
get(Class<? extends P> c,
String cond)
Method for getting objects from the database.
|
<P> P |
get(Class<? extends P> c,
String cond,
Object... bindVars)
Method for getting objects from the database.
|
<P extends Persistent> |
get(String classname,
long oid)
Method for getting objects from the database.
|
<P extends Persistent> |
get(String classname,
String cond)
Method for getting objects from the database.
|
<P extends Persistent> |
get(String classname,
String cond,
Object... bindVars)
Method for getting objects from the database.
|
<P> P |
getNoCache(Class<? extends P> c,
long oid)
Method for getting objects directly from the database bypassing the object cache.
|
long |
getOID()
Return the next object id from the oid-factory in the database
|
String |
getSchema()
Returns the schema of the tables
|
TableModel |
getTable(String q,
Object... bindVars)
Deprecated.
since ep90 use
getTable(String, Object[], int[]) with explicit type information instead |
TableModel |
getTable(String q,
Object[] bindVars,
int[] sqlTypes)
Returns the results of the given query.
|
Object |
getValue(int sqlType,
String stmt,
Object... bindVars)
Execute a SQL statement which returns one value.
|
Object |
getValue(String stmt)
Execute a SQL statement which returns one value.
|
Object |
getValue(String stmt,
int sqlType)
Deprecated.
use
getValue(int, String, Object...) instead |
Object |
getValue(String stmt,
Object... bindVars)
Execute a SQL statement which returns one value.
|
Object |
getValue(String stmt,
Object[] bindVars,
int sqlType)
Deprecated.
use
getValue(int, String, Object...) instead |
boolean |
hasRows(String stmt,
Object... bindVars)
Check whether the statement returns results.
|
boolean |
inDatabase(Persistent o)
Check whether the object is in database
|
void |
insert(Collection<?> collection)
Insert the objects of the collection into the database.
|
void |
insert(Persistent o)
Insert the object into the database.
|
<P> List<P> |
limitedList(Class<? extends P> c,
int maxRows,
int offset,
String cond,
String order,
Object... bindVars)
This method returns the members of the given class matching the given condition
and limiting the returned entry count.
|
<P> List<P> |
limitedList(Class<? extends P> c,
int maxRows,
String cond,
String order,
Object... bindVars)
This method returns the members of the given class matching the given condition
and limiting the returned entry count.
|
<P> List<P> |
list(Class<? extends P> c)
This method returns all members of the given class.
|
<P> List<P> |
list(Class<? extends P> c,
String cond)
This method returns the members of the given class matching the given condition.
|
<P> List<P> |
list(Class<? extends P> c,
String cond,
String order)
This method returns the members of the given class matching the given condition.
|
<P> List<P> |
list(Class<? extends P> c,
String cond,
String order,
Object... bindVars)
This method returns the members of the given class matching the given condition.
|
<P> List<P> |
list(Class<? extends P> c,
String cond,
String order,
Object[] bindVars,
int maxRows)
Deprecated.
|
<P> List<P> |
list(Class<? extends P> c,
String cond,
String order,
Object[] bindVars,
int maxRows,
int offset)
Deprecated.
|
<P extends Persistent> |
list(String classname)
This method returns all members of the given class.
|
<P extends Persistent> |
list(String classname,
String cond)
This method returns the members of the given class matching the given condition.
|
<P extends Persistent> |
list(String classname,
String cond,
String order)
This method returns the members of the given class matching the given condition.
|
<P extends Persistent> |
list(String classname,
String cond,
String order,
Object... bindVars)
This method returns the members of the given class matching the given condition.
|
<P> List<P> |
list2(Class<? extends P> c,
String q,
Object... bindVars)
This method returns the members of the given class matching the given condition.
|
<P extends Persistent> |
list2(String classname,
String q,
Object... bindVars)
This method returns the members of the given class matching the given condition.
|
<P> Set<P> |
setOf(Class<? extends P> c,
String cond,
Object... bindVars)
This method returns the members of the given class matching the given condition as a
Set . |
<P extends Persistent> |
setOf(String classname,
String cond,
Object... bindVars)
This method returns the members of the given class matching the given condition as a
Set . |
void |
setSchema(String schema)
Set the schema of the tables
|
<P> Map<Long,P> |
table(Class<? extends P> c,
String cond,
Object... bindVars)
This method returns the members of the given class matching the given condition as a
Map . |
<P extends Persistent> |
table(String classname,
String cond,
Object... bindVars)
This method returns the members of the given class matching the given condition as a
Map . |
int |
update(Collection<?> collection)
Updates the objects of the collection in the database.
|
int |
update(Persistent o)
Update the database tuple corresponding to the given object.
|
int |
update(Persistent o,
String... fieldNames)
Update some fields of the database tuple corresponding to the given object.
|
<P> List<P> list(Class<? extends P> c) throws RemoteException
c
- the class of the objectsRemoteException
<P extends Persistent> List<P> list(String classname) throws RemoteException
classname
- the name of the class of the objectRemoteException
<P> List<P> list(Class<? extends P> c, String cond) throws RemoteException
c
- the class of the objectscond
- a SQL conditionRemoteException
<P extends Persistent> List<P> list(String classname, String cond) throws RemoteException
classname
- the name of the class of the objectcond
- a SQL conditionRemoteException
<P> List<P> list(Class<? extends P> c, String cond, String order) throws RemoteException
c
- the class of the objectscond
- a SQL conditionorder
- a comma separated list of attribute names of the given class.RemoteException
<P extends Persistent> List<P> list(String classname, String cond, String order) throws RemoteException
classname
- the name of the class of the objectcond
- a SQL conditionorder
- a comma separated list of attribute names of the given class.RemoteException
<P> List<P> list(Class<? extends P> c, String cond, String order, Object... bindVars) throws RemoteException
c
- the class of the objectscond
- a SQL conditionorder
- a comma separated list of attribute names of the given class.bindVars
- if the condition contains place holders for binding variables this parameter should contain the valuesRemoteException
<P> List<P> limitedList(Class<? extends P> c, int maxRows, String cond, String order, Object... bindVars) throws RemoteException
Note that a unique order is not only strongly recommended; some DBMSs require an order by in this case. If an empty order is provided or when the order does not contain the oid column, OID is added as order column.
c
- the class of the objectsmaxRows
- the maximum number of entries to returncond
- a SQL conditionorder
- a comma separated list of attribute names of the given class.bindVars
- if the condition contains place holders for binding variables, this should contain the valuesRemoteException
@Deprecated <P> List<P> list(Class<? extends P> c, String cond, String order, Object[] bindVars, int maxRows) throws RemoteException
limitedList(Class, int, String, String, Object...)
insteadNote that a unique order is not only strongly recommended; some DBMSs require an order by in this case. If an empty order is provided or when the order does not contain the oid column, OID is added as order column.
c
- the class of the objectscond
- a SQL conditionorder
- a comma separated list of attribute names of the given class.bindVars
- if the condition contains place holders for binding variables this parameter should contain the valuesmaxRows
- the maximum number of entries to returnRemoteException
<P> List<P> limitedList(Class<? extends P> c, int maxRows, int offset, String cond, String order, Object... bindVars) throws RemoteException
Note that a unique order is not only strongly recommended; some DBMSs require an order by in this case. If an empty order is provided or when the order does not contain the oid column, OID is added as order column.
c
- the class of the objectsmaxRows
- the maximum number of entries to returnoffset
- number of rows to skip from the beginningcond
- a SQL conditionorder
- a comma separated list of attribute names of the given class.bindVars
- if the condition contains place holders for binding variables, this should contain the valuesRemoteException
@Deprecated <P> List<P> list(Class<? extends P> c, String cond, String order, Object[] bindVars, int maxRows, int offset) throws RemoteException
limitedList(Class, int, int, String, String, Object...)
insteadNote that a unique order is not only strongly recommended; some DBMSs require an order by in this case. If an empty order is provided or when the order does not contain the oid column, OID is added as order column.
c
- the class of the objectscond
- a SQL conditionorder
- a comma separated list of attribute names of the given class.bindVars
- if the condition contains place holders for binding variables this parameter should contain the valuesmaxRows
- the maximum number of entries to returnoffset
- number of rows to skip from the beginningRemoteException
<P extends Persistent> List<P> list(String classname, String cond, String order, Object... bindVars) throws RemoteException
classname
- the name of the class of the objectscond
- a SQL conditionorder
- a comma separated list of attribute names of the given class.bindVars
- if the condition contains place holders for binding variables this parameter should contain the valuesRemoteException
<P> List<P> list2(Class<? extends P> c, String q, Object... bindVars) throws RemoteException
StoreUtil.dbAttrs(Persistent, String)
dbAttrs(String) method to construct the attribute list,
that is to formulate "select "+StoreUtil.dbAttrs(user,"u")+" from avw_user u, avw_userrole ur where..."c
- the class of the objectsq
- a SQL querybindVars
- if the condition contains place holders for binding variables this parameter should contain the valuesRemoteException
<P extends Persistent> List<P> list2(String classname, String q, Object... bindVars) throws RemoteException
StoreUtil.dbAttrs(Persistent, String)
dbAttrs(String) method to construct the attribute list,
that is to formulate "select "+StoreUtil.dbAttrs(user,"u")+" from avw_user u, avw_userrole ur where..."classname
- the name of the class of the objectsq
- a SQL querybindVars
- if the condition contains place holders for binding variables this parameter should contain the valuesRemoteException
<P> Map<Long,P> table(Class<? extends P> c, String cond, Object... bindVars) throws RemoteException
Map
.
The keys of the map are the oids of the objects as Long objects, the values are the objects itself.c
- the class of the objectscond
- a SQL conditionbindVars
- if the condition contains place holders for binding variables this parameter should contain the valuesRemoteException
<P extends Persistent> Map<Long,P> table(String classname, String cond, Object... bindVars) throws RemoteException
Map
.
The keys of the table are the oids of the objects as Long objects, the values are the objects itself.classname
- the name of the class of the objectscond
- a SQL conditionbindVars
- if the condition contains place holders for binding variables this parameter should contain the valuesRemoteException
<P> Set<P> setOf(Class<? extends P> c, String cond, Object... bindVars) throws RemoteException
Set
.
The the values are the objects itself.c
- the class of the objectscond
- a SQL conditionbindVars
- if the condition contains place holders for binding variables this parameter should contain the valuesRemoteException
<P extends Persistent> Set<P> setOf(String classname, String cond, Object... bindVars) throws RemoteException
Set
.
The keys of the table are the oids of the objects as Long objects, the values are the objects itself.classname
- the name of the class of the objectscond
- a SQL conditionbindVars
- if the condition contains place holders for binding variables this parameter should contain the valuesRemoteException
int count(Class<?> c, String cond, Object... bindVars) throws RemoteException
c
- the classcond
- a SQL conditionbindVars
- if the condition contains place holders for binding variables this parameter should contain the valuesRemoteException
int count(String classname, String cond, Object... bindVars) throws RemoteException
classname
- the name of the classcond
- a SQL conditionbindVars
- if the condition contains place holders for binding variables this parameter should contain the valuesRemoteException
boolean inDatabase(Persistent o) throws RemoteException
RemoteException
boolean hasRows(String stmt, Object... bindVars) throws RemoteException
stmt
- the SQL statement text.bindVars
- if the stmt contains place holders for binding variables this parameter should contain the valuesRemoteException
<P> P get(Class<? extends P> c, long oid) throws RemoteException
c
- the class of the objectoid
- the oid of the objectRemoteException
<P extends Persistent> P get(String classname, long oid) throws RemoteException
classname
- the name of the class of the objectoid
- the oid of the objectRemoteException
<P> P get(Class<? extends P> c, String cond) throws RemoteException
c
- the class of the objectcond
- a SQL conditionRemoteException
<P extends Persistent> P get(String classname, String cond) throws RemoteException
classname
- the name of the class of the objectcond
- a SQL conditionRemoteException
<P> P get(Class<? extends P> c, String cond, Object... bindVars) throws RemoteException
c
- the class of the objectcond
- a SQL conditionbindVars
- if the condition contains place holders for binding variables this parameter should contain the valuesRemoteException
<P extends Persistent> P get(String classname, String cond, Object... bindVars) throws RemoteException
classname
- the name of the class of the objectcond
- a SQL conditionbindVars
- if the condition contains place holders for binding variables this parameter should contain the valuesRemoteException
<P> P fill(P o) throws RemoteException
o
- the objectRemoteException
<P extends Persistent> List<P> fill(List<P> l) throws RemoteException
l
- the list of objects to be filledRemoteException
void checkUnique(Persistent o) throws RemoteException
ApplicationException
if a duplicate of the given object is in the database.
It uses the key fields returned by method Persistent.getKeys()
of object o
for the comparison.o
- the objectRemoteException
<P extends Persistent,R extends Persistent> Set<P> fillByField(Class<? extends P> c, Collection<R> collection, String fieldname) throws RemoteException
c
- (super)class of the referenced Objectscollection
- the Collection of referencing objects, must all be filled.fieldname
- the name of the referencing field. Must be a Persistent
.RemoteException
<P extends Persistent,R extends Persistent> Set<P> fillByField(Class<? extends P> c, Collection<R> collection, String fieldname, String cond, Object... bindVars) throws RemoteException
c
- (super)class of the referenced Objectscollection
- the Collection of referencing objects, must all be filled.fieldname
- the name of the referencing field. Must be a Persistent
.cond
- an optional SQL condition.bindVars
- optional array of parameter bindings for the SQL statement.RemoteException
<P extends Persistent> void fillByFields(Collection<P> collection, String fieldNames) throws RemoteException
collection
- the Collection of referencing objects, must all be filled.fieldNames
- a comma separated string of field names. Every field name must denote a Persistent
field.RemoteException
void insert(Persistent o) throws RemoteException
o
- the objectRemoteException
void insert(Collection<?> collection) throws RemoteException
collection
- the objects to insert (all of the objects must implement Persistent)RemoteException
int update(Persistent o) throws RemoteException
o
- the objectRemoteException
int update(Collection<?> collection) throws RemoteException
collection
- the objects to update (all of the objects must implement Persistent)RemoteException
int update(Persistent o, String... fieldNames) throws RemoteException
o
- the objectfieldNames
- an array containing the names of the fields which should be updatedRemoteException
int delete(Persistent o) throws RemoteException
o
- the object to deleteRemoteException
int delete(Collection<?> collection) throws RemoteException
collection
- the objects to delete (all of the objects must implement Persistent)RemoteException
int delete(Class<?> c, String condition, Object... bindVars) throws RemoteException
Persistent.beforeDelete()
nor PersistentEventHandler.beforeDelete(Persistent)
methods
are called for the individual deleted objects.c
- the class of the objectscondition
- a SQL conditionbindVars
- if the condition contains place holders for binding variables this parameter should contain the valuesRemoteException
int delete(String classname, String condition, Object... bindVars) throws RemoteException
Persistent.beforeDelete()
nor PersistentEventHandler.beforeDelete(Persistent)
methods
are called for the individual deleted objects.classname
- the name of the class of the objectscondition
- a SQL conditionbindVars
- if the condition contains place holders for binding variables this parameter should contain the valuesRemoteException
int executeStatement(String stmt) throws RemoteException
stmt
- the SQL statement text.RemoteException
int executeStatement(String stmt, Object... bindVars) throws RemoteException
stmt
- the SQL statement text.bindVars
- if the stmt contains place holders for binding variables this parameter should contain the valuesRemoteException
long getOID() throws RemoteException
RemoteException
Object getValue(String stmt) throws RemoteException
stmt
- the SQL statement text.RemoteException
@Deprecated Object getValue(String stmt, int sqlType) throws RemoteException
getValue(int, String, Object...)
insteadstmt
- the SQL statement text.sqlType
- if a special mapping of the database type to java type is needed, the type (java.sql.Types)
can be specified here.RemoteException
Object getValue(String stmt, Object... bindVars) throws RemoteException
stmt
- the SQL statement text.bindVars
- if the stmt contains place holders for binding variables this parameter should contain the valuesRemoteException
Object getValue(int sqlType, String stmt, Object... bindVars) throws RemoteException
sqlType
- if a special mapping of the database type to java type is needed, the type (java.sql.Types)
can be specified here.stmt
- the SQL statement text.bindVars
- if the stmt contains place holders for binding variables, this should contain the valuesRemoteException
@Deprecated Object getValue(String stmt, Object[] bindVars, int sqlType) throws RemoteException
getValue(int, String, Object...)
insteadstmt
- the SQL statement text.bindVars
- if the stmt contains place holders for binding variables this parameter should contain the valuessqlType
- if a special mapping of the database type to java type is needed, the type (java.sql.Types)
can be specified here.RemoteException
@Deprecated TableModel getTable(String q, Object... bindVars) throws RemoteException
getTable(String, Object[], int[])
with explicit type information insteadq
- the sql-querybindVars
- if the query contains place holders for binding variables this parameter should contain the valuesRemoteException
TableModel getTable(String q, Object[] bindVars, int[] sqlTypes) throws RemoteException
q
- the sql-querybindVars
- if the query contains place holders for binding variables this parameter should contain the valuessqlTypes
- if a special mapping of database types to java types is needed, the types (java.sql.Types)
can be specified here. The length of the array must be equal to the number of columns in the result set.RemoteException
void setSchema(String schema) throws RemoteException
schema
- RemoteException
String getSchema() throws RemoteException
RemoteException
<P> P getNoCache(Class<? extends P> c, long oid) throws RemoteException
Should only be needed in special circumstances like comparing the current state of an object to an old state in the database.
The result should be used with care, in particular, its unwise to change it in any way.
c
- the class of the objectoid
- the oid of the objectRemoteException
@enterprise 10.0.39049 Copyright © 2024 FREQUENTIS AG. All Rights Reserved.