Interface IdBinder
- All Known Implementing Classes:
IdBinderEmbedded, IdBinderSimple
public interface IdBinder
Binds id values to prepared statements.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddBindValues(SpiExpressionBind request, Collection<?> ids) Binds multiple id value to a request.voidaddBindValues(DefaultSqlUpdate sqlUpdate, Collection<?> ids) Binds multiple id value to an update.voidappendSelect(DbSqlContext ctx, boolean subQuery) Append to the select clause.Build a string of the logical expressions.assocInExpr(String prefix) Return the logical id in expression taking into account embedded id's.Return the Id BeanProperty.Return the sql for binding the id to.voidBinds an id value to a prepared statement.voidbindId(DefaultSqlUpdate sqlUpdate, Object value) Bind the id value to a SqlUpdate statement.Return the sql for binding the id using an IN clause.Object[]bindValues(Object idValue) Return the values as an array of scalar bindable values.voidbuildRawSqlSelectChain(String prefix, List<String> selectChain) Return a key to use for bean caches given the id value.cacheKeyFromBean(io.ebean.bean.EntityBean bean) Return a key to use for bean caches given the bean.convertForJson(io.ebean.bean.EntityBean idValue) For EmbeddedId convert the idValue into a simple map.convertFromJson(Object value) For EmbeddedId the value is assumed to be a Map and this is takes the values from the map and builds an embedded id bean.Cast or convert the Id value if necessary.convertSetId(Object idValue, io.ebean.bean.EntityBean bean) Cast or convert the Id value if necessary and optionally set it.findBeanProperty(String dbColumnName) Find a BeanProperty that is mapped to the database column.idInValueExpr(boolean not, int size) Return the binding expression (like "?"idInValueExprDelete(int size) Same as getIdInValueExpr but for delete by id.idSelect()voidInitialise the binder.booleanReturn false if the id is a simple scalar and false if it is embedded or concatenated.booleanReturn true if this is a compound key and must use expanded and or form.voidloadIgnore(DbReadContext ctx) Ignore the appropriate number of scalar properties for this id.orderBy()Return the default order by that may need to be used if the query includes a many property.read(DbReadContext ctx) Read the id value from the result set and return it.Read the Id value from the binary DataInput.readSet(DbReadContext ctx, io.ebean.bean.EntityBean bean) Read the id value from the result set and set it to the bean also returning it.default intsize()Return the number of properties that make up the id.Object[]values(io.ebean.bean.EntityBean bean) Return the id values for a given bean.voidwriteData(DataOutput dataOutput, Object idValue) Write the Id value to binary DataOuput.
-
Method Details
-
initialise
void initialise()Initialise the binder. -
idSelect
String idSelect() -
isIdInExpandedForm
boolean isIdInExpandedForm()Return true if this is a compound key and must use expanded and or form. -
writeData
Write the Id value to binary DataOuput.- Throws:
IOException
-
readData
Read the Id value from the binary DataInput.- Throws:
IOException
-
beanProperty
STreeProperty beanProperty()Return the Id BeanProperty. -
findBeanProperty
Find a BeanProperty that is mapped to the database column. -
isComplexId
boolean isComplexId()Return false if the id is a simple scalar and false if it is embedded or concatenated. -
size
default int size()Return the number of properties that make up the id. -
orderBy
String orderBy()Return the default order by that may need to be used if the query includes a many property. -
orderBy
-
values
Return the id values for a given bean. -
bindValues
-
convertForJson
For EmbeddedId convert the idValue into a simple map. Otherwise the idValue is just returned as is.This is used to provide a simple JSON serializable version of the id value.
-
convertFromJson
For EmbeddedId the value is assumed to be a Map and this is takes the values from the map and builds an embedded id bean.For other simple id's this just returns the value (no conversion required).
This is used to provide a simple JSON serializable version of the id value.
-
assocExpr
-
assocInExpr
-
bindId
Binds an id value to a prepared statement.- Throws:
SQLException
-
bindId
Bind the id value to a SqlUpdate statement. -
addBindValues
Binds multiple id value to an update. -
addBindValues
Binds multiple id value to a request. -
bindInSql
-
idInValueExpr
Return the binding expression (like "?" or "(?,?)")for the Id. -
idInValueExprDelete
Same as getIdInValueExpr but for delete by id. -
buildRawSqlSelectChain
-
readSet
Read the id value from the result set and set it to the bean also returning it.- Throws:
SQLException
-
loadIgnore
Ignore the appropriate number of scalar properties for this id. -
read
Read the id value from the result set and return it.- Throws:
SQLException
-
appendSelect
Append to the select clause. -
bindEqSql
-
convertSetId
Cast or convert the Id value if necessary and optionally set it.The Id value is not assumed to be the correct type so it is converted to the correct type. Typically this is because we could get a Integer, Long or BigDecimal depending on the JDBC driver and situation.
If the bean is not null, then the value is set to the bean.
-
convertId
-
cacheKey
-
cacheKeyFromBean
Return a key to use for bean caches given the bean.
-