public class SQLEntityRefProperty extends BaseEntityRefProperty<Long,SQLEntity,SQLEntityRef<SQLEntity>> implements SQLPropertyInfo, ESPropertyInfo
| Modifier and Type | Class and Description |
|---|---|
static class |
SQLEntityRefProperty.Factory
Factory for generating properties based on their field type
|
entityRef, mixing, referencedDescriptor, referencedTypeaccessPath, alternativePropertyKey, defaultValue, descriptor, field, label, length, name, nameAsMapping, nullable, propertyKey, propertyName| Modifier | Constructor and Description |
|---|---|
protected |
SQLEntityRefProperty(EntityDescriptor descriptor,
AccessPath accessPath,
Field field) |
| Modifier and Type | Method and Description |
|---|---|
void |
contributeToTable(Table table)
Appends columns, keys and foreign keys to the given table to match the settings specified by
this property
|
void |
describeProperty(com.alibaba.fastjson.JSONObject description)
Creates the mapping description for this property into the given JSON.
|
protected Optional<SQLEntity> |
find(Class<SQLEntity> type,
sirius.kernel.commons.Value value)
Actually resolves the the type and value into an entity.
|
void |
setReferencedEntity(SQLEntity parent,
SQLEntity child)
Updates the field (
SQLEntityRef within the given parent to point to the given child. |
getEntityRef, getReferencedDescriptor, getReferencedType, getValueFromField, link, onBeforeSaveChecks, onDeleteCascade, onDeleteReject, onDeleteSetNull, setValueToField, transformFromDatasource, transformToDatasource, transformValuecheckNullability, checkUniqueness, determineDefaultValue, determineLengths, determineNullability, equals, getAnnotation, getDefaultValue, getDefinition, getDescriptor, getField, getLabel, getLength, getName, getPropertyName, getValue, getValueAsCopy, getValueForDatasource, hashCode, illegalFieldValue, isNullable, onAfterDelete, onAfterSave, onBeforeDelete, onBeforeSave, parseValue, setValue, setValueFromDatasource, toString, transformFromElastic, transformFromJDBC, transformFromMongo, transformToElastic, transformToJDBC, transformToMongois, makeNewInstance, tryAsclone, finalize, getClass, notify, notifyAll, wait, wait, waittransferOptionprotected SQLEntityRefProperty(EntityDescriptor descriptor, AccessPath accessPath, Field field)
public void contributeToTable(Table table)
SQLPropertyInfocontributeToTable in interface SQLPropertyInfotable - the table to add schema infos topublic void describeProperty(com.alibaba.fastjson.JSONObject description)
ESPropertyInfodescribeProperty in interface ESPropertyInfodescription - the target JSON to fillprotected Optional<SQLEntity> find(Class<SQLEntity> type, sirius.kernel.commons.Value value)
BaseEntityRefPropertyfind in class BaseEntityRefProperty<Long,SQLEntity,SQLEntityRef<SQLEntity>>type - the type to resolvevalue - the id to resolvepublic void setReferencedEntity(SQLEntity parent, SQLEntity child)
SQLEntityRef within the given parent to point to the given child.
It also ensures that the ID is propagated correctly. If a join fetch is executed, the id property might have beend skipped. This will reset the id within the EntityRef to -1, which is the placeholder of the id in the partially fetched entity. Therefore, we remember the original id, which is filled via the foreign key. We then apply the join-fetched value and restore the id (on both sides) if required.
parent - the parent containing the reference to the childchild - the referenced child entityCopyright © 2018. All rights reserved.