Module is.codion.framework.db.rmi
Package is.codion.framework.db.rmi
Interface RemoteEntityConnection
- All Superinterfaces:
AutoCloseable,Remote
A remote
EntityConnection, wrapping the connection running on the server.
This is the wire contract implemented by the server and adapted to EntityConnection
on the client side. Each method mirrors its EntityConnection counterpart, adding
RemoteException; refer to EntityConnection for the behavioral contract.
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes this connection.voidPerforms a commit and ends the current transaction.booleanintcount(EntityConnection.Count count) Counts the number of rows returned based on the given count conditions.default intcount(Supplier<EntityConnection.Count> count) Convenience overload accepting aEntityConnection.Count.Builderor anySupplierofEntityConnection.Count, removing the need for a trailingEntityConnection.Count.Builder.build()call.intDeletes the entities specified by the given condition.voiddelete(Entity.Key key) Deletes the entity with the given primary key.voiddelete(Collection<Entity.Key> keys) Deletes the entities with the given primary keys.dependencies(Collection<Entity> entities) Selects the entities that depend on the given entities via (non-soft) foreign keys, mapped to corresponding entityTypes.entities()<C extends EntityConnection,P, R>
@Nullable Rexecute(FunctionType<C, P, R> functionType) Executes the function with the given type with no parameter.<C extends EntityConnection,P, R>
@Nullable Rexecute(FunctionType<C, P, R> functionType, @Nullable P parameter) Executes the function with the given type.<C extends EntityConnection,P>
voidexecute(ProcedureType<C, P> procedureType) Executes the procedure with the given type with no parameter.<C extends EntityConnection,P>
voidexecute(ProcedureType<C, P> procedureType, @Nullable P parameter) Executes the procedure with the given type.Inserts the given entity, returning the primary key.insert(Collection<Entity> entities) Inserts the given entities, returning the primary keys.insertSelect(Entity entity) Inserts the given entity, returning the inserted entity.insertSelect(Collection<Entity> entities) Inserts the given entities, returning the inserted entities.iterator(EntityConnection.Select select) Returns a result set iterator based on the given select.Returns a result set iterator based on the given query condition.default RemoteEntityResultIteratoriterator(Supplier<EntityConnection.Select> select) Convenience overload accepting aEntityConnection.Select.Builderor anySupplierofEntityConnection.Select, removing the need for a trailingEntityConnection.Select.Builder.build()call.<P,R> R report(ReportType<P, R> reportType, @Nullable P parameter) Fills the given report using a JDBC datasource and returns the result.voidPerforms a rollback and ends the current transaction.select(EntityConnection.Select select) Selects entities based on the given select.<T> List<T> Selects ordered and distinct non-null values of the given column.<T> List<T> select(Column<T> column, EntityConnection.Select select) Selects distinct non-null values of the given column.<T> List<T> Selects distinct non-null values of the given column.default <T> List<T> select(Column<T> column, Supplier<EntityConnection.Select> select) Convenience overload accepting aEntityConnection.Select.Builderor anySupplierofEntityConnection.Select, removing the need for a trailingEntityConnection.Select.Builder.build()call.Selects entities based on the given condition.select(Entity.Key key) Selects an entity by key.select(Collection<Entity.Key> keys) Selects entities based on the givenkeys.select(Supplier<EntityConnection.Select> select) Convenience overload accepting aEntityConnection.Select.Builderor anySupplierofEntityConnection.Select, removing the need for a trailingEntityConnection.Select.Builder.build()call.selectSingle(EntityConnection.Select select) Selects a single entity based on the specified select.selectSingle(Condition condition) Selects a single entity based on the specified condition.default EntityselectSingle(Supplier<EntityConnection.Select> select) Convenience overload accepting aEntityConnection.Select.Builderor anySupplierofEntityConnection.Select, removing the need for a trailingEntityConnection.Select.Builder.build()call.voidStarts a transaction on this connection.booleanintupdate(EntityConnection.Update update) Performs an update based on the given update.voidUpdates the given entity based on its attribute values.voidupdate(Collection<Entity> entities) Updates the given entities based on their attribute values.default intupdate(Supplier<EntityConnection.Update> update) Convenience overload accepting anEntityConnection.Update.Builderor anySupplierofEntityConnection.Update, removing the need for a trailingEntityConnection.Update.Builder.build()call.updateSelect(Entity entity) Updates the given entity based on its attribute values, returning the updated entity.updateSelect(Collection<Entity> entities) Updates the given entities based on their attribute values, returning the updated entities.user()
-
Method Details
-
entities
- Returns:
- the underlying domain entities
- Throws:
RemoteException- in case of an exception- See Also:
-
user
- Returns:
- the user being used by this connection
- Throws:
RemoteException- in case of an exception- See Also:
-
connected
- Returns:
- true if this connection has been established and is valid
- Throws:
RemoteException- in case of an exception- See Also:
-
close
Closes this connection.- Specified by:
closein interfaceAutoCloseable- Throws:
RemoteException- in case of an exception- See Also:
-
transactionOpen
- Returns:
- true if a transaction is open, false otherwise
- Throws:
RemoteException- in case of exception- See Also:
-
startTransaction
Starts a transaction on this connection.- Throws:
IllegalStateException- if a transaction is already openRemoteException- in case of exception- See Also:
-
rollbackTransaction
Performs a rollback and ends the current transaction.- Throws:
DatabaseException- in case the rollback failedIllegalStateException- in case a transaction is not openRemoteException- in case of a remote exception- See Also:
-
commitTransaction
Performs a commit and ends the current transaction.- Throws:
DatabaseException- in case the commit failedIllegalStateException- in case a transaction is not openRemoteException- in case of a remote exception- See Also:
-
execute
<C extends EntityConnection,P, @Nullable R executeR> (FunctionType<C, P, throws RemoteExceptionR> functionType) Executes the function with the given type with no parameter.- Type Parameters:
C- the connection typeP- the parameter typeR- the return value type- Parameters:
functionType- the function type- Returns:
- the function return value
- Throws:
RemoteException- in case of a remote exception- See Also:
-
execute
<C extends EntityConnection,P, @Nullable R executeR> (FunctionType<C, P, throws RemoteExceptionR> functionType, @Nullable P parameter) Executes the function with the given type.- Type Parameters:
C- the connection typeP- the parameter typeR- the return value type- Parameters:
functionType- the function typeparameter- the function parameter- Returns:
- the function return value
- Throws:
RemoteException- in case of a remote exception- See Also:
-
execute
<C extends EntityConnection,P> void execute(ProcedureType<C, P> procedureType) throws RemoteExceptionExecutes the procedure with the given type with no parameter.- Type Parameters:
C- the connection typeP- the procedure parameter type- Parameters:
procedureType- the procedure type- Throws:
RemoteException- in case of a remote exception- See Also:
-
execute
<C extends EntityConnection,P> void execute(ProcedureType<C, P> procedureType, @Nullable P parameter) throws RemoteExceptionExecutes the procedure with the given type.- Type Parameters:
C- the connection typeP- the procedure parameter type- Parameters:
procedureType- the procedure typeparameter- the procedure parameter- Throws:
RemoteException- in case of a remote exception- See Also:
-
insert
Inserts the given entity, returning the primary key.- Parameters:
entity- the entity to insert- Returns:
- the primary key of the inserted entity
- Throws:
RemoteException- in case of a remote exception- See Also:
-
insertSelect
Inserts the given entity, returning the inserted entity.- Parameters:
entity- the entity to insert- Returns:
- the inserted entity
- Throws:
RemoteException- in case of a remote exception- See Also:
-
insert
Inserts the given entities, returning the primary keys.- Parameters:
entities- the entities to insert- Returns:
- the primary keys of the inserted entities
- Throws:
RemoteException- in case of a remote exception- See Also:
-
insertSelect
Inserts the given entities, returning the inserted entities.- Parameters:
entities- the entities to insert- Returns:
- the inserted entities
- Throws:
RemoteException- in case of a remote exception- See Also:
-
update
Updates the given entity based on its attribute values.- Parameters:
entity- the entity to update- Throws:
RemoteException- in case of a remote exception- See Also:
-
updateSelect
Updates the given entity based on its attribute values, returning the updated entity.- Parameters:
entity- the entity to update- Returns:
- the updated entity
- Throws:
RemoteException- in case of a remote exception- See Also:
-
update
Updates the given entities based on their attribute values.- Parameters:
entities- the entities to update- Throws:
RemoteException- in case of a remote exception- See Also:
-
updateSelect
Updates the given entities based on their attribute values, returning the updated entities.- Parameters:
entities- the entities to update- Returns:
- the updated entities, in no particular order
- Throws:
RemoteException- in case of a remote exception- See Also:
-
update
Performs an update based on the given update.- Parameters:
update- the update to perform- Returns:
- the number of affected rows
- Throws:
RemoteException- in case of a remote exception- See Also:
-
update
Convenience overload accepting anEntityConnection.Update.Builderor anySupplierofEntityConnection.Update, removing the need for a trailingEntityConnection.Update.Builder.build()call.- Parameters:
update- the update supplier, typically anEntityConnection.Update.Builder- Returns:
- the number of affected rows
- Throws:
RemoteException- in case of a remote exception- See Also:
-
delete
Deletes the entity with the given primary key.- Parameters:
key- the primary key of the entity to delete- Throws:
RemoteException- in case of a remote exception- See Also:
-
delete
Deletes the entities with the given primary keys.- Parameters:
keys- the primary keys of the entities to delete- Throws:
RemoteException- in case of a remote exception- See Also:
-
delete
Deletes the entities specified by the given condition.- Parameters:
condition- the condition specifying the entities to delete- Returns:
- the number of deleted rows
- Throws:
RemoteException- in case of a remote exception- See Also:
-
select
Selects ordered and distinct non-null values of the given column.- Type Parameters:
T- the value type- Parameters:
column- the column- Returns:
- all the values of the given column
- Throws:
RemoteException- in case of a remote exception- See Also:
-
select
Selects distinct non-null values of the given column.- Type Parameters:
T- the value type- Parameters:
column- columncondition- the condition- Returns:
- the values of the given column
- Throws:
RemoteException- in case of a remote exception- See Also:
-
select
Selects distinct non-null values of the given column.- Type Parameters:
T- the value type- Parameters:
column- the columnselect- the select to perform- Returns:
- the values of the given column
- Throws:
RemoteException- in case of a remote exception- See Also:
-
select
default <T> List<T> select(Column<T> column, Supplier<EntityConnection.Select> select) throws RemoteException Convenience overload accepting aEntityConnection.Select.Builderor anySupplierofEntityConnection.Select, removing the need for a trailingEntityConnection.Select.Builder.build()call.- Type Parameters:
T- the column value type- Parameters:
column- the column for which to retrieve the valuesselect- the select supplier, typically aEntityConnection.Select.Builder- Returns:
- the values of the given column
- Throws:
RemoteException- in case of a remote exception- See Also:
-
select
Selects an entity by key.- Parameters:
key- the key of the entity to select- Returns:
- an entity having the key
key - Throws:
RemoteException- in case of a remote exception- See Also:
-
selectSingle
Selects a single entity based on the specified condition.- Parameters:
condition- the condition specifying the entity to select- Returns:
- the entity based on the given condition
- Throws:
RemoteException- in case of a remote exception- See Also:
-
selectSingle
Selects a single entity based on the specified select.- Parameters:
select- the select to perform- Returns:
- the entity based on the given select
- Throws:
RemoteException- in case of a remote exception- See Also:
-
selectSingle
Convenience overload accepting aEntityConnection.Select.Builderor anySupplierofEntityConnection.Select, removing the need for a trailingEntityConnection.Select.Builder.build()call.- Parameters:
select- the select supplier, typically aEntityConnection.Select.Builder- Returns:
- the entity based on the given select
- Throws:
RemoteException- in case of a remote exception- See Also:
-
select
Selects entities based on the givenkeys.- Parameters:
keys- the keys used in the condition- Returns:
- entities based on
keys - Throws:
RemoteException- in case of a remote exception- See Also:
-
select
Selects entities based on the given condition.- Parameters:
condition- the condition specifying which entities to select- Returns:
- entities based on the given condition
- Throws:
RemoteException- in case of a remote exception- See Also:
-
select
Selects entities based on the given select.- Parameters:
select- the select to perform- Returns:
- entities based on the given select
- Throws:
RemoteException- in case of a remote exception- See Also:
-
select
Convenience overload accepting aEntityConnection.Select.Builderor anySupplierofEntityConnection.Select, removing the need for a trailingEntityConnection.Select.Builder.build()call.- Parameters:
select- the select supplier, typically aEntityConnection.Select.Builder- Returns:
- entities based on the given select
- Throws:
RemoteException- in case of a remote exception- See Also:
-
dependencies
Selects the entities that depend on the given entities via (non-soft) foreign keys, mapped to corresponding entityTypes.- Parameters:
entities- the entities for which to retrieve dependencies- Returns:
- the entities that depend on
entities - Throws:
RemoteException- in case of a remote exception- See Also:
-
count
Counts the number of rows returned based on the given count conditions.- Parameters:
count- the count conditions- Returns:
- the number of rows fitting the given count conditions
- Throws:
RemoteException- in case of a remote exception- See Also:
-
count
Convenience overload accepting aEntityConnection.Count.Builderor anySupplierofEntityConnection.Count, removing the need for a trailingEntityConnection.Count.Builder.build()call.- Parameters:
count- the count supplier, typically aEntityConnection.Count.Builder- Returns:
- the number of rows fitting the given count conditions
- Throws:
RemoteException- in case of a remote exception- See Also:
-
report
Fills the given report using a JDBC datasource and returns the result.- Type Parameters:
P- the report parameters typeR- the report result type- Parameters:
reportType- the report to fillparameter- the report parameter, if any- Returns:
- the filled result object
- Throws:
RemoteException- in case of a remote exception- See Also:
-
iterator
Returns a result set iterator based on the given query condition. Note that the returned iterator is wrapped to present theEntityResultIteratorinterface to client code.- Parameters:
condition- the query condition- Returns:
- an iterator for the given query condition
- Throws:
RemoteException- in case of a remote exception- See Also:
-
iterator
Returns a result set iterator based on the given select. Note that the returned iterator is wrapped to present theEntityResultIteratorinterface to client code.- Parameters:
select- the query select- Returns:
- an iterator for the given query select
- Throws:
RemoteException- in case of a remote exception- See Also:
-
iterator
default RemoteEntityResultIterator iterator(Supplier<EntityConnection.Select> select) throws RemoteException Convenience overload accepting aEntityConnection.Select.Builderor anySupplierofEntityConnection.Select, removing the need for a trailingEntityConnection.Select.Builder.build()call.- Parameters:
select- the select supplier, typically aEntityConnection.Select.Builder- Returns:
- an iterator for the given query select
- Throws:
RemoteException- in case of a remote exception- See Also:
-