- All Implemented Interfaces:
IdBinder
-
Constructor Summary
ConstructorsConstructorDescriptionIdBinderSimple(BeanProperty idProperty, io.ebeaninternal.server.persist.platform.MultiValueBind multiValueBind) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddBindValues(SpiExpressionBind request, Collection<?> values) 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(EntityBean bean) Return a key to use for bean caches given the bean.convertForJson(EntityBean bean) 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, 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 "?" or "(?,?)")for the Id.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, EntityBean bean) Read the id value from the result set and set it to the bean also returning it.Object[]values(EntityBean bean) Return the id values for a given bean.voidwriteData(DataOutput os, Object value) Write the Id value to binary DataOuput.
-
Constructor Details
-
IdBinderSimple
public IdBinderSimple(BeanProperty idProperty, io.ebeaninternal.server.persist.platform.MultiValueBind multiValueBind)
-
-
Method Details
-
initialise
public void initialise()Description copied from interface:IdBinderInitialise the binder.- Specified by:
initialisein interfaceIdBinder
-
idSelect
-
isIdInExpandedForm
public boolean isIdInExpandedForm()Description copied from interface:IdBinderReturn true if this is a compound key and must use expanded and or form.- Specified by:
isIdInExpandedFormin interfaceIdBinder
-
orderBy
-
buildRawSqlSelectChain
- Specified by:
buildRawSqlSelectChainin interfaceIdBinder
-
beanProperty
Description copied from interface:IdBinderReturn the Id BeanProperty.- Specified by:
beanPropertyin interfaceIdBinder
-
findBeanProperty
Description copied from interface:IdBinderFind a BeanProperty that is mapped to the database column.- Specified by:
findBeanPropertyin interfaceIdBinder
-
isComplexId
public boolean isComplexId()Description copied from interface:IdBinderReturn false if the id is a simple scalar and false if it is embedded or concatenated.- Specified by:
isComplexIdin interfaceIdBinder
-
orderBy
Description copied from interface:IdBinderReturn the default order by that may need to be used if the query includes a many property. -
bindInSql
Description copied from interface:IdBinderReturn the sql for binding the id using an IN clause. -
bindEqSql
Description copied from interface:IdBinderReturn the sql for binding the id to. This includes table alias and columns that make up the id. -
values
Description copied from interface:IdBinderReturn the id values for a given bean. -
bindValues
Description copied from interface:IdBinderReturn the values as an array of scalar bindable values.For concatenated keys that use an Embedded bean or multiple id properties this determines the field values are returns them as an Object array.
Added primarily for Query.addWhere().add(Expr.idEq()) support.
- Specified by:
bindValuesin interfaceIdBinder
-
idInValueExprDelete
Description copied from interface:IdBinderSame as getIdInValueExpr but for delete by id.- Specified by:
idInValueExprDeletein interfaceIdBinder
-
idInValueExpr
Description copied from interface:IdBinderReturn the binding expression (like "?" or "(?,?)")for the Id.- Specified by:
idInValueExprin interfaceIdBinder
-
addBindValues
Description copied from interface:IdBinderBinds multiple id value to an update.- Specified by:
addBindValuesin interfaceIdBinder
-
addBindValues
Description copied from interface:IdBinderBinds multiple id value to a request.- Specified by:
addBindValuesin interfaceIdBinder
-
convertForJson
Description copied from interface:IdBinderFor 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.
- Specified by:
convertForJsonin interfaceIdBinder
-
convertFromJson
Description copied from interface:IdBinderFor 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.
- Specified by:
convertFromJsonin interfaceIdBinder
-
bindId
Description copied from interface:IdBinderBind the id value to a SqlUpdate statement. -
bindId
public void bindId(io.ebeaninternal.server.bind.DataBind dataBind, Object value) throws SQLException Description copied from interface:IdBinderBinds an id value to a prepared statement.- Specified by:
bindIdin interfaceIdBinder- Throws:
SQLException
-
writeData
Description copied from interface:IdBinderWrite the Id value to binary DataOuput.- Specified by:
writeDatain interfaceIdBinder- Throws:
IOException
-
readData
Description copied from interface:IdBinderRead the Id value from the binary DataInput.- Specified by:
readDatain interfaceIdBinder- Throws:
IOException
-
loadIgnore
Description copied from interface:IdBinderIgnore the appropriate number of scalar properties for this id.- Specified by:
loadIgnorein interfaceIdBinder
-
readSet
Description copied from interface:IdBinderRead the id value from the result set and set it to the bean also returning it.- Specified by:
readSetin interfaceIdBinder- Throws:
SQLException
-
read
Description copied from interface:IdBinderRead the id value from the result set and return it.- Specified by:
readin interfaceIdBinder- Throws:
SQLException
-
appendSelect
Description copied from interface:IdBinderAppend to the select clause.- Specified by:
appendSelectin interfaceIdBinder
-
assocExpr
Description copied from interface:IdBinderBuild a string of the logical expressions.Typically used to build a id = ? string.
-
assocInExpr
Description copied from interface:IdBinderReturn the logical id in expression taking into account embedded id's.- Specified by:
assocInExprin interfaceIdBinder
-
convertId
Description copied from interface:IdBinderCast or convert the Id value if necessary. -
convertSetId
Description copied from interface:IdBinderCast 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.
- Specified by:
convertSetIdin interfaceIdBinder
-
cacheKey
Description copied from interface:IdBinderReturn a key to use for bean caches given the id value. -
cacheKeyFromBean
Description copied from interface:IdBinderReturn a key to use for bean caches given the bean.- Specified by:
cacheKeyFromBeanin interfaceIdBinder
-