Class BeanDescriptor<T>
- java.lang.Object
-
- io.ebeaninternal.server.deploy.BeanDescriptor<T>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
BeanDescriptor.EntityType
-
Constructor Summary
Constructors Constructor Description BeanDescriptor(BeanDescriptorMap owner, DeployBeanDescriptor<T> deploy)
Construct the BeanDescriptor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(BeanFkeyProperty fkey)
Add objects to ElPropertyDeploy etc.void
addInheritanceWhere(Query<?> query)
Add the discriminator value to the query if needed.Collection<? extends Property>
allProperties()
Return all the properties for this bean type.void
appendOrderById(SpiQuery<T> query)
Appends the Id property to the OrderBy clause if it is not believed to be already contained in the order by.Object
beanId(Object bean)
Return the bean id.void
bindElementValue(SqlUpdate insert, Object value)
Bind all the property values to the SqlUpdate.void
bindId(DataBind dataBind, Object idValue)
Bind the idValue to the preparedStatement.void
cacheApplyBeanUpdate(String key, Map<String,Object> changes, boolean updateNaturalKey, long version)
Apply the update to the cache.void
cacheApplyInvalidate(Collection<Object> ids)
Remove a collection of beans from the cache given the ids.T
cacheBeanGet(Object id, Boolean readOnly, PersistenceContext context)
Return a bean from the bean cache (or null).boolean
cacheBeanLoad(EntityBean bean, EntityBeanIntercept ebi, Object id, PersistenceContext context)
Returns true if it managed to populate/load the bean from the cache.Set<EntityBeanIntercept>
cacheBeanLoadAll(List<EntityBeanIntercept> list, PersistenceContext persistenceContext, int lazyLoadProperty, String propertyName)
Hit the bean cache trying to load a list/batch of entities.void
cacheBeanPut(EntityBean bean)
Put a bean into the bean cache (taking into account inheritance).void
cacheBeanPut(T bean)
Put the bean into the cache.void
cacheBeanPutAll(Collection<?> beans)
CachedBeanData
cacheEmbeddedBeanExtract(EntityBean bean)
Extract the raw cache data from the embedded bean.EntityBean
cacheEmbeddedBeanLoad(CachedBeanData data, PersistenceContext context)
Load the embedded bean (taking into account inheritance).BeanCacheResult<T>
cacheIdLookup(PersistenceContext context, Collection<?> ids)
String
cacheKey(Object id)
Return the cache key for the given id value.void
cacheManyPropClear(String propertyName)
boolean
cacheManyPropLoad(BeanPropertyAssocMany<?> many, BeanCollection<?> bc, Object parentId, Boolean readOnly)
Try to load the beanCollection from cache return true if successful.void
cacheManyPropPut(BeanPropertyAssocMany<?> many, BeanCollection<?> bc, Object parentId)
Put the beanCollection into the cache.void
cacheManyPropPut(String name, Object parentId, CachedManyIds entry)
Update the bean collection entry in the cache.void
cacheManyPropRemove(String propertyName, Object parentId)
void
cacheNaturalKeyPut(String key, String newKey)
void
cachePersistDelete(Object id, PersistRequestBean<T> deleteRequest, CacheChangeSet changeSet)
Remove a bean from the cache given its Id.void
cachePersistDeleteByIds(Collection<Object> ids, CacheChangeSet changeSet)
Remove a bean from the cache given its Id.void
cachePersistInsert(PersistRequestBean<T> insertRequest, CacheChangeSet changeSet)
Add the insert changes to the changeSet.void
cachePersistUpdate(Object id, PersistRequestBean<T> updateRequest, CacheChangeSet changeSet)
Add the update to the changeSet.void
cacheUpdateQuery(boolean update, SpiTransaction transaction)
Check if bulk update or delete query has a cache impact.void
checkMutableProperties(EntityBeanIntercept ebi)
Check for mutable scalar types and mark as dirty if necessary.void
clearBeanCache()
Clear the bean cache.void
clearQueryCache()
Clear the query cache.void
clearQueryStatistics()
Reset the statistics on all the query plans.void
contextClear(PersistenceContext pc, Object idValue)
Clear a bean from the persistence context.void
contextDeleted(PersistenceContext pc, Object idValue)
Delete a bean from the persistence context (such that we don't fetch it in the same transaction).Object
contextGet(PersistenceContext pc, Object id)
Get the bean from the persistence context.PersistenceContext.WithOption
contextGetWithOption(PersistenceContext pc, Object id)
Get the bean from the persistence context with delete check option.void
contextPut(PersistenceContext pc, Object id, Object bean)
Put the bean into the persistence context.Object
contextPutIfAbsent(PersistenceContext pc, Object id, EntityBean localBean)
Put the bean into the persistence context if it is absent.Object
contextRef(PersistenceContext pc, Boolean readOnly, boolean disableLazyLoad, Object id)
Create a reference bean and put it in the persistence context (and return it).Object
convertId(Object idValue)
Convert the type of the idValue if required.String
convertOrmUpdateToSql(String ormUpdateStatement)
Convert the logical orm update statement into sql by converting the bean properties and bean name to database columns and table.Object
convertSetId(Object idValue, EntityBean bean)
Convert and set the id value.T
createBean()
Create a new instance of the bean.T
createBeanUsingDisc(Object discValue)
Create a bean given the discriminator value.EntityBean
createEntityBean()
Creates a new entity bean without invokingBeanPostConstructListener.postCreate(Object)
EntityBean
createEntityBeanForJson()
Create an entity bean for JSON marshalling (which differs for the element collection case).T
createRef(Object id, PersistenceContext pc)
T
createReference(Boolean readOnly, boolean disableLazyLoad, Object id, PersistenceContext pc)
Create a reference bean based on the id.T
createReference(Object id, PersistenceContext pc)
Create a non read only reference bean without checking cacheSharableBeans.SqlUpdate
deleteById(Object id, List<Object> idList, DeleteMode mode)
void
deregister(BeanPersistController controller)
De-register the BeanPersistController.void
deregister(BeanPersistListener listener)
De-register the BeanPersistListener.Map<String,ValuePair>
diff(EntityBean newBean, EntityBean oldBean)
Return the diff comparing the bean values.void
diff(String prefix, Map<String,ValuePair> map, EntityBean newBean, EntityBean oldBean)
Populate the diff for updates with flattened non-null property values.BeanDocType<T>
docStore()
Return the doc store helper for this bean type.DocStoreBeanAdapter<T>
docStoreAdapter()
Return doc store adapter for internal use for processing persist requests.void
docStoreDeleteById(Object idValue, DocStoreUpdateContext txn)
void
docStoreInsert(Object idValue, PersistRequestBean<T> persistRequest, DocStoreUpdateContext bulkUpdate)
void
docStoreMapping(DocMappingBuilder mapping, String prefix)
Build the Document mapping recursively with the given prefix relative to the root of the document.void
docStoreUpdate(Object idValue, PersistRequestBean<T> persistRequest, DocStoreUpdateContext bulkUpdate)
void
docStoreUpdateEmbedded(PersistRequestBean<T> request, DocStoreUpdates docStoreUpdates)
Check if this update invalidates an embedded part of a doc store document.void
draftQueryOptimise(Query<T> query)
Optimise the draft query fetching any draftable element relationships.boolean
draftReset(T draftBean)
Reset properties on the draft bean based on @DraftDirty and @DraftReset.ExtraJoin
extraJoin(String propertyPath)
Return an extra join if the property path requires it.String
findBeanPath(String tableName, String columnName)
Return the property path given the db table and column.BeanProperty
findProperty(String propName)
Find a BeanProperty including searching the inheritance hierarchy.BeanProperty
findPropertyFromPath(String path)
Return the bean property traversing the object graph and taking into account inheritance.STreeProperty
findPropertyWithDynamic(String propName, String path)
Return a property that is part of the SQL tree.String
getBaseTable()
Return the base table.String
getBaseTable(SpiQuery.TemporalMode mode)
Return the base table to use given the query temporal mode.String
getBaseTableAlias()
Return the base table alias.<U> BeanDescriptor<U>
getBeanDescriptor(Class<U> otherType)
Return the BeanDescriptor of another bean type.BeanDescriptor<?>
getBeanDescriptor(String path)
Return the BeanDescriptor for a given path of Associated One or Many beans.BeanFindController
getBeanFinder()
Return the beanFinder (Migrate over to getFindController).Object
getBeanId(T bean)
Return the id value for the given bean.BeanProperty
getBeanProperty(String propName)
Get a BeanProperty by its name.Class<T>
getBeanType()
Return the class type this BeanDescriptor describes.BeanType<?>
getBeanTypeAtPath(String path)
Return the type bean for an OneToMany or ManyToOne or ManyToMany property.Object[]
getBindIdValues(Object idValue)
Return the id as an array of scalar bindable values.CacheOptions
getCacheOptions()
Return the cache options.BeanChange
getChangeLogBean(PersistRequestBean<T> request)
Return true if this request should be included in the change log.ConcurrencyMode
getConcurrencyMode(EntityBeanIntercept ebi)
String
getDbComment()
Return the DB comment for the base table.String
getDefaultOrderBy()
Return the default order by that may need to be added if a many property is included in the query.String
getDefaultSelectClause()
Return the default select clause.String
getDeleteByIdInSql()
Return the "delete by id" sql.String[]
getDependentTables()
Return the dependent tables for a view based entity.String
getDescriptorId()
Return bean class name.String
getDiscColumn()
Return the discriminator column.String
getDiscValue()
Return the discriminator value for this bean type (or null when there is no inheritance).DocumentMapping
getDocMapping()
Return the DocumentMapping for this bean type.io.ebean.annotation.DocStoreMode
getDocStoreMode(PersistRequest.Type persistType, io.ebean.annotation.DocStoreMode txnMode)
Return the type of DocStoreMode that should occur for this type of persist request given the transactions requested mode.String
getDocStoreQueueId()
Return the queueId used to uniquely identify this type when queuing an index updateAdd.String
getDraftTable()
Return the associated draft table.SpiEbeanServer
getEbeanServer()
Return the EbeanServer instance that owns this BeanDescriptor.ElComparator<T>
getElComparator(String propNameOrSortBy)
ElPropertyValue
getElGetValue(String propName)
Get an Expression language Value object.ElPropertyDeploy
getElPropertyDeploy(String propName)
Similar to ElPropertyValue but also uses foreign key shortcuts.EncryptKey
getEncryptKey(BeanProperty p)
Return the Encrypt key given the BeanProperty.EncryptKey
getEncryptKey(String tableName, String columnName)
Return the Encrypt key given the table and column name.BeanDescriptor.EntityType
getEntityType()
Return the type of this domain object.ExpressionPath
getExpressionPath(String path)
Return the ExpressionPath for a given property path.BeanFindController
getFindController()
Return the find controller (SPI interface).String
getFullName()
Return the bean class name this descriptor is used for.Object
getId(EntityBean bean)
Helper method to return the unique property.IdBinder
getIdBinder()
Return the IdBinder which is helpful for handling the various types of Id.String
getIdBinderIdSql(String alias)
Return the sql for binding an id.String
getIdBinderInLHSSql()
Return the sql for binding id's using an IN clause.IdentityMode
getIdentityMode()
Object
getIdForJson(Object bean)
Return the Id value for the bean with embeddedId beans converted into maps.String
getIdName()
Return the Id property name or null if no Id property exists.BeanProperty
getIdProperty()
Return the Id property.IdType
getIdType()
Return the identity generation type.IndexDefinition[]
getIndexDefinitions()
Return the compound unique constraints.List<BeanType<?>>
getInheritanceChildren()
Returns all direct children of this beantypeBeanType<?>
getInheritanceParent()
Returns the parent in inheritance hiearchyInheritInfo
getInheritInfo()
Returns the Inheritance mapping information.BeanPropertyAssocMany<?>
getManyProperty(SpiQuery<?> query)
Return the many property included in the query or null if one is not.String
getName()
Return the short name of the entity bean.String
getNamedQuery(String name)
Return the named ORM query.SpiRawSql
getNamedRawSql(String named)
Return the named RawSql query.BeanNaturalKey
getNaturalKey()
Return the natural key.BeanProperty
getOrderColumn()
Return the order column property.PartitionMeta
getPartitionMeta()
Return the partition details of the bean.BeanPersistController
getPersistController()
Return the Controller.BeanPersistListener
getPersistListener()
Return the beanListener.TableJoin
getPrimaryKeyJoin()
Property
getProperty(String propName)
Return the Property to read values from a bean.BeanQueryAdapter
getQueryAdapter()
Return the BeanQueryAdapter or null if none is defined.CQueryPlan
getQueryPlan(CQueryPlanKey key)
ReadAuditLogger
getReadAuditLogger()
Return the ReadAuditLogger for logging read audit events.ScalarType<?>
getScalarType(int jdbcType)
Return the Scalar type for the given JDBC type.ScalarType<?>
getScalarType(String cast)
String
getSelectLastInsertedId(boolean publish)
Return the SQL used to return the last inserted id.ServerConfig
getServerConfig()
Return the ServerConfig.String
getSoftDeletePredicate(String tableAlias)
Return the soft delete predicate using the given table alias.String
getStorageEngine()
Return the storage engine.BeanProperty
getTenantProperty()
Return the tenant property when multi-tenant partitioning support is used.BeanPropertyAssocOne<?>
getUnidirectional()
Return the "shadow" property to support unidirectional relationships.List<BeanProperty[]>
getUniqueProps()
String
getUpdateImportedIdSql(ImportedId prop)
Return a Sql update statement to set the importedId value (deferred execution).SpiUpdatePlan
getUpdatePlan(String key)
Get a UpdatePlan for a given hash.long
getVersion(EntityBean entityBean)
Return the version value in primitive long form (if exists and set).BeanProperty
getVersionProperty()
Return the first version property that exists on the bean.BeanProperty
getWhenCreatedProperty()
Return the 'when created' property if there is one defined.BeanProperty
getWhenModifiedProperty()
Return the 'when modified' property if there is one defined.String
getWhereIdInSql()
Return the "where id in" sql (for use with UpdateQuery).boolean
hasDefaultSelectClause()
Return true if this bean type has a default select clause that is not simply select all properties.boolean
hasId()
Return true if the underlying type has an Id property.boolean
hasInheritance()
Return true if this bean type has an inheritance hierarchy.boolean
includesAggregation(OrmQueryDetail detail)
Return true if the query detail includes an aggregation property.void
inheritanceLoad(SqlBeanLoad sqlBeanLoad, STreeProperty property, DbReadContext ctx)
Load the property taking into account inheritance.void
initialiseOther(io.ebeaninternal.server.deploy.BeanDescriptorInitContext initContext)
Initialise the exported and imported parts for associated properties.boolean
isAutoTunable()
Return true if queries for beans of this type are auto tunable.boolean
isBaseTable()
Return true if this type is a base table entity type.boolean
isBatchEscalateOnCascade(PersistRequest.Type type)
Return false if JDBC batch can't be implicitly escalated to.boolean
isBeanCaching()
Return true if there is currently bean caching for this type of bean.boolean
isCacheNotify(PersistRequest.Type type, boolean publish)
Return true if the persist request needs to notify the cache.boolean
isCacheSharableBeans()
Return true if this bean can cache sharable instances.boolean
isChangeLog()
boolean
isDeleteByBulk()
boolean
isDeleteByStatement()
Return true if delete can use a single SQL statement.boolean
isDocStoreEmbeddedInvalidation()
Return true if this bean type has embedded doc store invalidation.boolean
isDocStoreMapped()
Return true if this type maps to a root type of a doc store document (not embedded or ignored).boolean
isDocStoreOnly()
Return true if this is a "Doc Store only" entity bean.boolean
isDraftable()
Return true if this entity type is draftable.boolean
isDraftableElement()
Return true if this entity type is a draftable element (child).boolean
isDraftInstance(EntityBean entityBean)
Return true if the bean is considered a 'draft' instance (not 'live').boolean
isEmbedded()
Return true if this is an embedded bean.boolean
isEmbeddedPath(String propertyPath)
Return true if the given path is an embedded bean.boolean
isGeneratedProperty(int propertyIndex)
Return true if this is a generated property.boolean
isHistorySupport()
Return true if this entity bean has history support.boolean
isIdGeneratedValue()
Return true if the Id value is marked as a@GeneratedValue
.boolean
isIdLoaded(EntityBeanIntercept ebi)
boolean
isInheritanceRoot()
Return true if this object is the root level object in its entity inheritance.boolean
isInsertMode(EntityBeanIntercept ebi, boolean insertMode)
Return true if this bean should be inserted rather than updated.boolean
isJsonReadCollection()
boolean
isLiveInstance(EntityBean entityBean)
Return true if the bean is draftable and considered a 'live' instance.boolean
isManyPropCaching()
boolean
isMultiTenant()
Return true if this type is tenant aware.boolean
isMultiValueIdSupported()
Return true if this type has a simple Id and the platform supports mutli-value binding.boolean
isNaturalKeyCaching()
Return true if there is a natural key defined for this bean type.boolean
isPadInExpression()
Return true if Id IN expression should have bind parameters padded.boolean
isQueryCaching()
Return true if there is query caching for this type of bean.boolean
isRawSqlBased()
Returns true if this bean is based on RawSql.boolean
isReadAuditing()
Return true if read auditing is on this entity bean.boolean
isReference(EntityBeanIntercept ebi)
boolean
isSoftDelete()
Return true if the type uses soft delete.boolean
isUseIdGenerator()
Return true if this bean type should use IdGeneration.boolean
isValidExpression(String propertyName)
Return true if the property is a valid known property or path for the given bean type.T
jsonRead(SpiJsonReader jsonRead, String path)
Object
jsonReadCollection(SpiJsonReader readJson, EntityBean parentBean)
void
jsonWrite(SpiJsonWriter writeJson, EntityBean bean)
void
jsonWrite(SpiJsonWriter writeJson, EntityBean bean, String key)
void
jsonWriteDirty(SpiJsonWriter writeJson, EntityBean bean, boolean[] dirtyProps)
void
jsonWriteElement(SpiJsonWriter ctx, Object element)
void
jsonWriteMapEntry(SpiJsonWriter ctx, Map.Entry<?,?> entry)
boolean
lazyLoadMany(EntityBeanIntercept ebi)
Return true if the lazy loading property is a Many in which case just define a Reference for the collection and not invoke a query.void
lazyLoadRegister(String prefix, EntityBeanIntercept ebi, EntityBean bean, LoadContext loadContext)
Register all the assoc many properties on this bean that are not populated with the load context.void
markAsDeleted(EntityBean bean)
Mark the bean as deleted by setting the softDelete property to true.void
merge(EntityBean bean, EntityBean existing)
void
metricPersistBatch(PersistRequest.Type type, long startNanos, int size)
void
metricPersistNoBatch(PersistRequest.Type type, long startNanos)
BeanCacheResult<T>
naturalKeyLookup(PersistenceContext context, Set<Object> keys)
Use natural key lookup to hit the bean cache.Object
nextId(Transaction t)
DeployPropertyParser
parser()
void
postLoad(Object bean)
Execute the postLoad if a BeanPostLoad exists for this bean.void
preAllocateIds(int batchSize)
void
prepareQuery(SpiQuery<T> query)
Prepare the query for multi-tenancy check for document store only use.Collection<BeanProperty>
propertiesAll()
Return a collection of all BeanProperty.BeanProperty[]
propertiesBaseScalar()
Scalar properties without the unique id or secondary table properties.BeanPropertyAssocOne<?>[]
propertiesEmbedded()
Return the beans that are embedded.BeanProperty[]
propertiesGenInsert()
Return the properties set as generated values on insert.BeanProperty[]
propertiesGenUpdate()
Return the properties set as generated values on update.BeanProperty[]
propertiesLocal()
Return the properties local to this type for inheritance.BeanPropertyAssocMany<?>[]
propertiesMany()
All Assoc Many's for this descriptor.BeanPropertyAssocMany<?>[]
propertiesManyDelete()
Assoc Many's with delete cascade.BeanPropertyAssocMany<?>[]
propertiesManySave()
Assoc Many's with save cascade.BeanPropertyAssocMany<?>[]
propertiesManyToMany()
Assoc ManyToMany's.BeanProperty[]
propertiesNonMany()
All Non Assoc Many's for this descriptor.BeanProperty[]
propertiesNonTransient()
Return the non transient non id properties.BeanPropertyAssocOne<?>[]
propertiesOne()
All the BeanPropertyAssocOne that are not embedded.BeanPropertyAssocOne<?>[]
propertiesOneExportedDelete()
Exported assoc ones with delete cascade.BeanPropertyAssocOne<?>[]
propertiesOneExportedSave()
Exported assoc ones with cascade save.BeanPropertyAssocOne<?>[]
propertiesOneImported()
Returns ManyToOnes and OneToOnes on the imported owning side.BeanPropertyAssocOne<?>[]
propertiesOneImportedDelete()
Imported Assoc Ones with cascade delete true.BeanPropertyAssocOne<?>[]
propertiesOneImportedSave()
Imported Assoc Ones with cascade save true.BeanProperty[]
propertiesTransient()
Return the transient properties.BeanProperty
propertyByIndex(int pos)
BeanProperty
propertyUnmappedJson()
Return the property that holds unmapped JSON content.STreeProperty[]
propsBaseScalar()
Return the scalar properties.STreePropertyAssoc[]
propsEmbedded()
Return the embedded bean properties.STreePropertyAssocMany[]
propsMany()
Return the associated many properties.STreePropertyAssocOne[]
propsOne()
Return the associated one properties.T
publish(T draftBean, T liveBean)
void
putQueryPlan(CQueryPlanKey key, CQueryPlan plan)
void
putUpdatePlan(String key, SpiUpdatePlan plan)
Add a UpdatePlan to the cache with a given hash.Object
queryCacheGet(Object id)
Get a query result from the query cache.void
queryCachePut(Object id, QueryCacheEntry entry)
Put a query result into the query cache.void
readAuditBean(String queryKey, String bindLog, Object bean)
Write a bean read to the read audit log.void
readAuditFutureList(SpiQuery<T> spiQuery)
Prepare the read audit of a findFutureList() query.void
readAuditFutureMany(ReadEvent event)
Write a futureList many read to the read audit log.void
readAuditMany(String queryKey, String bindLog, List<Object> ids)
Write a many bean read to the read audit log.void
register(BeanPersistController newController)
Register the new BeanPersistController.void
register(BeanPersistListener newPersistListener)
Register the new BeanPersistController.void
resetManyProperties(Object dbBean)
Reset the many properties to empty state ready for reloading.BeanType<?>
root()
Return the root bean type if part of inheritance hierarchy.String
rootName()
Return the full name taking into account inheritance.void
setAllLoaded(EntityBean bean)
Set all properties to be loaded (recurse to embedded beans).void
setBeanId(T bean, Object idValue)
Set the bean id value converting if necessary.void
setDraft(EntityBean entityBean)
Set the draft to true for this entity bean instance.void
setDraftDirty(EntityBean entityBean, boolean value)
If there is a @DraftDirty property set it's value on the bean.void
setEbeanServer(SpiEbeanServer ebeanServer)
Set the server.void
setGeneratedId(EntityBean entityBean, Transaction transaction)
Set the generated Id value if appropriate.void
setId(Object idValue, EntityBean bean)
Set the Id value to the bean (without type conversion).void
setSoftDeleteValue(EntityBean bean)
void
setTenantId(EntityBean entityBean, Object tenantId)
Set the Tenant Id value to the bean.long
setVersion(EntityBean entityBean, Object versionValue)
Set the version value returning it in primitive long form.void
sort(List<T> list, String sortByClause)
boolean
supportsSelectLastInsertedId()
Return true if this bean uses a SQL select to fetch the last inserted id value.boolean
suppressForeignKey()
Return true if foreign keys to the base table should be suppressed.String
toString()
Summary description.void
visitAllInheritanceChildren(Consumer<BeanType<?>> visitor)
Visit all children recursivelyvoid
visitMetrics(MetricVisitor visitor)
Visit all the ORM query plan metrics (includes UpdateQuery with updates and deletes).
-
-
-
Constructor Detail
-
BeanDescriptor
public BeanDescriptor(BeanDescriptorMap owner, DeployBeanDescriptor<T> deploy)
Construct the BeanDescriptor.
-
-
Method Detail
-
getServerConfig
public ServerConfig getServerConfig()
Return the ServerConfig.
-
setEbeanServer
public void setEbeanServer(SpiEbeanServer ebeanServer)
Set the server. Primarily so that the Many's can lazy load.
-
getEbeanServer
public SpiEbeanServer getEbeanServer()
Return the EbeanServer instance that owns this BeanDescriptor.
-
isDocStoreOnly
public boolean isDocStoreOnly()
Return true if this is a "Doc Store only" entity bean.- Specified by:
isDocStoreOnly
in interfaceBeanType<T>
-
getEntityType
public BeanDescriptor.EntityType getEntityType()
Return the type of this domain object.
-
propertyByIndex
public BeanProperty propertyByIndex(int pos)
-
initialiseOther
public void initialiseOther(io.ebeaninternal.server.deploy.BeanDescriptorInitContext initContext)
Initialise the exported and imported parts for associated properties.
-
isBatchEscalateOnCascade
public boolean isBatchEscalateOnCascade(PersistRequest.Type type)
Return false if JDBC batch can't be implicitly escalated to. This happens when we have circular import id situation (need to defer setting identity value).
-
metricPersistBatch
public void metricPersistBatch(PersistRequest.Type type, long startNanos, int size)
-
metricPersistNoBatch
public void metricPersistNoBatch(PersistRequest.Type type, long startNanos)
-
merge
public void merge(EntityBean bean, EntityBean existing)
-
bindElementValue
public void bindElementValue(SqlUpdate insert, Object value)
Bind all the property values to the SqlUpdate.
-
getReadAuditLogger
public ReadAuditLogger getReadAuditLogger()
Return the ReadAuditLogger for logging read audit events.
-
isChangeLog
public boolean isChangeLog()
-
getChangeLogBean
public BeanChange getChangeLogBean(PersistRequestBean<T> request)
Return true if this request should be included in the change log.
-
deleteById
public SqlUpdate deleteById(Object id, List<Object> idList, DeleteMode mode)
-
getWhereIdInSql
public String getWhereIdInSql()
Return the "where id in" sql (for use with UpdateQuery).
-
getDeleteByIdInSql
public String getDeleteByIdInSql()
Return the "delete by id" sql.
-
add
public void add(BeanFkeyProperty fkey)
Add objects to ElPropertyDeploy etc. These are used so that expressions on foreign keys don't require an extra join.
-
getCacheOptions
public CacheOptions getCacheOptions()
Return the cache options.
-
getEncryptKey
public EncryptKey getEncryptKey(BeanProperty p)
Return the Encrypt key given the BeanProperty.
-
getEncryptKey
public EncryptKey getEncryptKey(String tableName, String columnName)
Return the Encrypt key given the table and column name.
-
getScalarType
public ScalarType<?> getScalarType(int jdbcType)
Return the Scalar type for the given JDBC type.
-
getScalarType
public ScalarType<?> getScalarType(String cast)
-
hasDefaultSelectClause
public boolean hasDefaultSelectClause()
Return true if this bean type has a default select clause that is not simply select all properties.
-
getDefaultSelectClause
public String getDefaultSelectClause()
Return the default select clause.
-
isInheritanceRoot
public boolean isInheritanceRoot()
Return true if this object is the root level object in its entity inheritance.- Specified by:
isInheritanceRoot
in interfaceBeanType<T>
-
isDocStoreMapped
public boolean isDocStoreMapped()
Return true if this type maps to a root type of a doc store document (not embedded or ignored).- Specified by:
isDocStoreMapped
in interfaceBeanType<T>
-
isDocStoreEmbeddedInvalidation
public boolean isDocStoreEmbeddedInvalidation()
Return true if this bean type has embedded doc store invalidation.
-
getDocStoreQueueId
public String getDocStoreQueueId()
Return the queueId used to uniquely identify this type when queuing an index updateAdd.- Specified by:
getDocStoreQueueId
in interfaceBeanType<T>
-
getDocMapping
public DocumentMapping getDocMapping()
Description copied from interface:BeanType
Return the DocumentMapping for this bean type.This is the document structure and mapping options for how this bean type is mapped for the document store.
- Specified by:
getDocMapping
in interfaceBeanType<T>
-
docStore
public BeanDocType<T> docStore()
Return the doc store helper for this bean type.
-
docStoreAdapter
public DocStoreBeanAdapter<T> docStoreAdapter()
Return doc store adapter for internal use for processing persist requests.
-
docStoreMapping
public void docStoreMapping(DocMappingBuilder mapping, String prefix)
Build the Document mapping recursively with the given prefix relative to the root of the document.
-
getNamedQuery
public String getNamedQuery(String name)
Return the named ORM query.
-
getNamedRawSql
public SpiRawSql getNamedRawSql(String named)
Return the named RawSql query.
-
getDocStoreMode
public io.ebean.annotation.DocStoreMode getDocStoreMode(PersistRequest.Type persistType, io.ebean.annotation.DocStoreMode txnMode)
Return the type of DocStoreMode that should occur for this type of persist request given the transactions requested mode.
-
docStoreInsert
public void docStoreInsert(Object idValue, PersistRequestBean<T> persistRequest, DocStoreUpdateContext bulkUpdate) throws IOException
- Throws:
IOException
-
docStoreUpdate
public void docStoreUpdate(Object idValue, PersistRequestBean<T> persistRequest, DocStoreUpdateContext bulkUpdate) throws IOException
- Throws:
IOException
-
docStoreUpdateEmbedded
public void docStoreUpdateEmbedded(PersistRequestBean<T> request, DocStoreUpdates docStoreUpdates)
Check if this update invalidates an embedded part of a doc store document.
-
docStoreDeleteById
public void docStoreDeleteById(Object idValue, DocStoreUpdateContext txn) throws IOException
- Throws:
IOException
-
draftReset
public boolean draftReset(T draftBean)
Reset properties on the draft bean based on @DraftDirty and @DraftReset.
-
prepareQuery
public void prepareQuery(SpiQuery<T> query)
Prepare the query for multi-tenancy check for document store only use.
-
getNaturalKey
public BeanNaturalKey getNaturalKey()
Return the natural key.
-
isBeanCaching
public boolean isBeanCaching()
Return true if there is currently bean caching for this type of bean.- Specified by:
isBeanCaching
in interfaceBeanType<T>
-
isNaturalKeyCaching
public boolean isNaturalKeyCaching()
Return true if there is a natural key defined for this bean type.
-
isQueryCaching
public boolean isQueryCaching()
Return true if there is query caching for this type of bean.- Specified by:
isQueryCaching
in interfaceBeanType<T>
-
isManyPropCaching
public boolean isManyPropCaching()
-
isCacheNotify
public boolean isCacheNotify(PersistRequest.Type type, boolean publish)
Return true if the persist request needs to notify the cache.
-
clearBeanCache
public void clearBeanCache()
Description copied from interface:BeanType
Clear the bean cache.- Specified by:
clearBeanCache
in interfaceBeanType<T>
-
clearQueryCache
public void clearQueryCache()
Clear the query cache.- Specified by:
clearQueryCache
in interfaceBeanType<T>
-
queryCacheGet
public Object queryCacheGet(Object id)
Get a query result from the query cache.
-
queryCachePut
public void queryCachePut(Object id, QueryCacheEntry entry)
Put a query result into the query cache.
-
cacheManyPropLoad
public boolean cacheManyPropLoad(BeanPropertyAssocMany<?> many, BeanCollection<?> bc, Object parentId, Boolean readOnly)
Try to load the beanCollection from cache return true if successful.
-
cacheManyPropPut
public void cacheManyPropPut(BeanPropertyAssocMany<?> many, BeanCollection<?> bc, Object parentId)
Put the beanCollection into the cache.
-
cacheManyPropPut
public void cacheManyPropPut(String name, Object parentId, CachedManyIds entry)
Update the bean collection entry in the cache.
-
cacheManyPropRemove
public void cacheManyPropRemove(String propertyName, Object parentId)
-
cacheManyPropClear
public void cacheManyPropClear(String propertyName)
-
cacheEmbeddedBeanExtract
public CachedBeanData cacheEmbeddedBeanExtract(EntityBean bean)
Extract the raw cache data from the embedded bean.
-
cacheEmbeddedBeanLoad
public EntityBean cacheEmbeddedBeanLoad(CachedBeanData data, PersistenceContext context)
Load the embedded bean (taking into account inheritance).
-
cacheBeanPut
public void cacheBeanPut(T bean)
Put the bean into the cache.
-
cacheBeanPut
public void cacheBeanPut(EntityBean bean)
Put a bean into the bean cache (taking into account inheritance).
-
cacheBeanPutAll
public void cacheBeanPutAll(Collection<?> beans)
-
cacheBeanGet
public T cacheBeanGet(Object id, Boolean readOnly, PersistenceContext context)
Return a bean from the bean cache (or null).
-
cacheApplyInvalidate
public void cacheApplyInvalidate(Collection<Object> ids)
Remove a collection of beans from the cache given the ids.
-
cacheBeanLoadAll
public Set<EntityBeanIntercept> cacheBeanLoadAll(List<EntityBeanIntercept> list, PersistenceContext persistenceContext, int lazyLoadProperty, String propertyName)
Hit the bean cache trying to load a list/batch of entities. Return the set of entities that were successfully loaded from L2 cache.
-
cacheBeanLoad
public boolean cacheBeanLoad(EntityBean bean, EntityBeanIntercept ebi, Object id, PersistenceContext context)
Returns true if it managed to populate/load the bean from the cache.
-
cacheIdLookup
public BeanCacheResult<T> cacheIdLookup(PersistenceContext context, Collection<?> ids)
-
naturalKeyLookup
public BeanCacheResult<T> naturalKeyLookup(PersistenceContext context, Set<Object> keys)
Use natural key lookup to hit the bean cache.
-
cacheNaturalKeyPut
public void cacheNaturalKeyPut(String key, String newKey)
-
cacheUpdateQuery
public void cacheUpdateQuery(boolean update, SpiTransaction transaction)
Check if bulk update or delete query has a cache impact.
-
cachePersistDeleteByIds
public void cachePersistDeleteByIds(Collection<Object> ids, CacheChangeSet changeSet)
Remove a bean from the cache given its Id.
-
cachePersistDelete
public void cachePersistDelete(Object id, PersistRequestBean<T> deleteRequest, CacheChangeSet changeSet)
Remove a bean from the cache given its Id.
-
cachePersistInsert
public void cachePersistInsert(PersistRequestBean<T> insertRequest, CacheChangeSet changeSet)
Add the insert changes to the changeSet.
-
cachePersistUpdate
public void cachePersistUpdate(Object id, PersistRequestBean<T> updateRequest, CacheChangeSet changeSet)
Add the update to the changeSet.
-
cacheApplyBeanUpdate
public void cacheApplyBeanUpdate(String key, Map<String,Object> changes, boolean updateNaturalKey, long version)
Apply the update to the cache.
-
readAuditFutureList
public void readAuditFutureList(SpiQuery<T> spiQuery)
Prepare the read audit of a findFutureList() query.
-
readAuditBean
public void readAuditBean(String queryKey, String bindLog, Object bean)
Write a bean read to the read audit log.
-
readAuditMany
public void readAuditMany(String queryKey, String bindLog, List<Object> ids)
Write a many bean read to the read audit log.
-
readAuditFutureMany
public void readAuditFutureMany(ReadEvent event)
Write a futureList many read to the read audit log.
-
getBaseTableAlias
public String getBaseTableAlias()
Return the base table alias. This is always the first letter of the bean name.
-
preAllocateIds
public void preAllocateIds(int batchSize)
-
nextId
public Object nextId(Transaction t)
-
parser
public DeployPropertyParser parser()
-
convertOrmUpdateToSql
public String convertOrmUpdateToSql(String ormUpdateStatement)
Convert the logical orm update statement into sql by converting the bean properties and bean name to database columns and table.
-
visitMetrics
public void visitMetrics(MetricVisitor visitor)
Visit all the ORM query plan metrics (includes UpdateQuery with updates and deletes).
-
clearQueryStatistics
public void clearQueryStatistics()
Reset the statistics on all the query plans.
-
postLoad
public void postLoad(Object bean)
Execute the postLoad if a BeanPostLoad exists for this bean.
-
getQueryPlan
public CQueryPlan getQueryPlan(CQueryPlanKey key)
-
putQueryPlan
public void putQueryPlan(CQueryPlanKey key, CQueryPlan plan)
-
getUpdatePlan
public SpiUpdatePlan getUpdatePlan(String key)
Get a UpdatePlan for a given hash.
-
putUpdatePlan
public void putUpdatePlan(String key, SpiUpdatePlan plan)
Add a UpdatePlan to the cache with a given hash.
-
getUpdateImportedIdSql
public String getUpdateImportedIdSql(ImportedId prop)
Return a Sql update statement to set the importedId value (deferred execution).
-
isDeleteByStatement
public boolean isDeleteByStatement()
Return true if delete can use a single SQL statement.This implies cascade delete does not continue depth wise and that this is no associated L2 bean caching.
-
isDeleteByBulk
public boolean isDeleteByBulk()
-
getWhenModifiedProperty
public BeanProperty getWhenModifiedProperty()
Return the 'when modified' property if there is one defined.- Specified by:
getWhenModifiedProperty
in interfaceBeanType<T>
-
getWhenCreatedProperty
public BeanProperty getWhenCreatedProperty()
Return the 'when created' property if there is one defined.- Specified by:
getWhenCreatedProperty
in interfaceBeanType<T>
-
getManyProperty
public BeanPropertyAssocMany<?> getManyProperty(SpiQuery<?> query)
Return the many property included in the query or null if one is not.
-
getIdBinder
public IdBinder getIdBinder()
Return the IdBinder which is helpful for handling the various types of Id.- Specified by:
getIdBinder
in interfaceSTreeType
-
hasId
public boolean hasId()
Description copied from interface:STreeType
Return true if the underlying type has an Id property.
-
isMultiValueIdSupported
public boolean isMultiValueIdSupported()
Return true if this type has a simple Id and the platform supports mutli-value binding.
-
isPadInExpression
public boolean isPadInExpression()
Return true if Id IN expression should have bind parameters padded.
-
getIdBinderIdSql
public String getIdBinderIdSql(String alias)
Return the sql for binding an id. This is the columns with table alias that make up the id.
-
getIdBinderInLHSSql
public String getIdBinderInLHSSql()
Return the sql for binding id's using an IN clause.
-
bindId
public void bindId(DataBind dataBind, Object idValue) throws SQLException
Bind the idValue to the preparedStatement.This takes care of the various id types such as embedded beans etc.
- Throws:
SQLException
-
getBindIdValues
public Object[] getBindIdValues(Object idValue)
Return the id as an array of scalar bindable values.This 'flattens' any EmbeddedId or multiple Id property cases.
-
createBean
public T createBean()
Description copied from interface:BeanType
Create a new instance of the bean.- Specified by:
createBean
in interfaceBeanType<T>
-
createEntityBean
public EntityBean createEntityBean()
Creates a new entity bean without invokingBeanPostConstructListener.postCreate(Object)
- Specified by:
createEntityBean
in interfaceSTreeType
-
createEntityBeanForJson
public EntityBean createEntityBeanForJson()
Create an entity bean for JSON marshalling (which differs for the element collection case).
-
createReference
public T createReference(Boolean readOnly, boolean disableLazyLoad, Object id, PersistenceContext pc)
Create a reference bean based on the id.
-
createReference
public T createReference(Object id, PersistenceContext pc)
Create a non read only reference bean without checking cacheSharableBeans.
-
createRef
public T createRef(Object id, PersistenceContext pc)
-
findPropertyFromPath
public BeanProperty findPropertyFromPath(String path)
Return the bean property traversing the object graph and taking into account inheritance.- Specified by:
findPropertyFromPath
in interfaceSTreeType
-
getBeanTypeAtPath
public BeanType<?> getBeanTypeAtPath(String path)
Description copied from interface:BeanType
Return the type bean for an OneToMany or ManyToOne or ManyToMany property.- Specified by:
getBeanTypeAtPath
in interfaceBeanType<T>
-
getBeanDescriptor
public BeanDescriptor<?> getBeanDescriptor(String path)
Return the BeanDescriptor for a given path of Associated One or Many beans.
-
getBeanDescriptor
public <U> BeanDescriptor<U> getBeanDescriptor(Class<U> otherType)
Return the BeanDescriptor of another bean type.
-
getOrderColumn
public BeanProperty getOrderColumn()
Return the order column property.
-
getUnidirectional
public BeanPropertyAssocOne<?> getUnidirectional()
Return the "shadow" property to support unidirectional relationships.For bidirectional this is a real property on the bean. For unidirectional relationships we have this 'shadow' property which is not externally visible.
-
isUseIdGenerator
public boolean isUseIdGenerator()
Return true if this bean type should use IdGeneration.If this is false and the Id is null it is assumed that a database auto increment feature is being used to populate the id.
-
getDescriptorId
public String getDescriptorId()
Return bean class name.
-
getBeanType
@Nonnull public Class<T> getBeanType()
Return the class type this BeanDescriptor describes.- Specified by:
getBeanType
in interfaceBeanType<T>
-
getFullName
@Nonnull public String getFullName()
Return the bean class name this descriptor is used for.If this BeanDescriptor is for a table then this returns the table name instead.
- Specified by:
getFullName
in interfaceBeanType<T>
-
contextGet
public Object contextGet(PersistenceContext pc, Object id)
Get the bean from the persistence context.
-
contextGetWithOption
public PersistenceContext.WithOption contextGetWithOption(PersistenceContext pc, Object id)
Get the bean from the persistence context with delete check option.
-
contextPut
public void contextPut(PersistenceContext pc, Object id, Object bean)
Put the bean into the persistence context.
-
contextPutIfAbsent
public Object contextPutIfAbsent(PersistenceContext pc, Object id, EntityBean localBean)
Put the bean into the persistence context if it is absent.- Specified by:
contextPutIfAbsent
in interfaceSTreeType
-
contextRef
public Object contextRef(PersistenceContext pc, Boolean readOnly, boolean disableLazyLoad, Object id)
Create a reference bean and put it in the persistence context (and return it).
-
contextClear
public void contextClear(PersistenceContext pc, Object idValue)
Clear a bean from the persistence context.
-
contextDeleted
public void contextDeleted(PersistenceContext pc, Object idValue)
Delete a bean from the persistence context (such that we don't fetch it in the same transaction).
-
getId
public Object getId(EntityBean bean)
Helper method to return the unique property. If only one property makes up the unique id then it's value is returned. If there is a concatenated unique id then a Map is built with the keys being the names of the properties that make up the unique id.
-
beanId
public Object beanId(Object bean)
Description copied from interface:BeanType
Return the bean id. This is the same as getBeanId() but without the generic type.
-
getBeanId
public Object getBeanId(T bean)
Description copied from interface:BeanType
Return the id value for the given bean.
-
getIdForJson
public Object getIdForJson(Object bean)
Return the Id value for the bean with embeddedId beans converted into maps.The usage is to provide simple id types for JSON processing (for embeddedId's).
-
getDefaultOrderBy
public String getDefaultOrderBy()
Return the default order by that may need to be added if a many property is included in the query.
-
setBeanId
public void setBeanId(T bean, Object idValue)
Set the bean id value converting if necessary.
-
convertSetId
public Object convertSetId(Object idValue, EntityBean bean)
Convert and set the id value.If the bean is not null, the id value is set to the id property of the bean after it has been converted to the correct type.
-
setId
public void setId(Object idValue, EntityBean bean)
Set the Id value to the bean (without type conversion).
-
getProperty
public Property getProperty(String propName)
Description copied from interface:BeanType
Return the Property to read values from a bean.- Specified by:
getProperty
in interfaceBeanType<T>
-
getBeanProperty
public BeanProperty getBeanProperty(String propName)
Get a BeanProperty by its name.
-
getElComparator
public ElComparator<T> getElComparator(String propNameOrSortBy)
-
lazyLoadRegister
public void lazyLoadRegister(String prefix, EntityBeanIntercept ebi, EntityBean bean, LoadContext loadContext)
Register all the assoc many properties on this bean that are not populated with the load context.This provides further lazy loading via the load context.
-
lazyLoadMany
public boolean lazyLoadMany(EntityBeanIntercept ebi)
Return true if the lazy loading property is a Many in which case just define a Reference for the collection and not invoke a query.
-
isGeneratedProperty
public boolean isGeneratedProperty(int propertyIndex)
Return true if this is a generated property.
-
isValidExpression
public boolean isValidExpression(String propertyName)
Description copied from interface:BeanType
Return true if the property is a valid known property or path for the given bean type.- Specified by:
isValidExpression
in interfaceBeanType<T>
-
getElGetValue
public ElPropertyValue getElGetValue(String propName)
Get an Expression language Value object.
-
getExpressionPath
public ExpressionPath getExpressionPath(String path)
Description copied from interface:BeanType
Return the ExpressionPath for a given property path.This can return a property or nested property path.
- Specified by:
getExpressionPath
in interfaceBeanType<T>
-
getElPropertyDeploy
public ElPropertyDeploy getElPropertyDeploy(String propName)
Similar to ElPropertyValue but also uses foreign key shortcuts.The foreign key shortcuts means we can avoid unnecessary joins.
-
findBeanPath
public String findBeanPath(String tableName, String columnName)
Return the property path given the db table and column.
-
findPropertyWithDynamic
public STreeProperty findPropertyWithDynamic(String propName, String path)
Return a property that is part of the SQL tree.The property can be a dynamic formula or a well known bean property.
- Specified by:
findPropertyWithDynamic
in interfaceSTreeType
-
findProperty
public BeanProperty findProperty(String propName)
Find a BeanProperty including searching the inheritance hierarchy.This searches this BeanDescriptor and then searches further down the inheritance tree (not up).
- Specified by:
findProperty
in interfaceSTreeType
-
resetManyProperties
public void resetManyProperties(Object dbBean)
Reset the many properties to empty state ready for reloading.
-
isCacheSharableBeans
public boolean isCacheSharableBeans()
Return true if this bean can cache sharable instances.This means is has no relationships and has readOnly=true in its cache options.
-
isAutoTunable
public boolean isAutoTunable()
Return true if queries for beans of this type are auto tunable.
-
getInheritInfo
public InheritInfo getInheritInfo()
Returns the Inheritance mapping information. This will be null if this type of bean is not involved in any ORM inheritance mapping.- Specified by:
getInheritInfo
in interfaceSTreeType
-
hasInheritance
public boolean hasInheritance()
Description copied from interface:BeanType
Return true if this bean type has an inheritance hierarchy.- Specified by:
hasInheritance
in interfaceBeanType<T>
-
getDiscColumn
public String getDiscColumn()
Description copied from interface:BeanType
Return the discriminator column.- Specified by:
getDiscColumn
in interfaceBeanType<T>
-
getDiscValue
public String getDiscValue()
Return the discriminator value for this bean type (or null when there is no inheritance).
-
createBeanUsingDisc
public T createBeanUsingDisc(Object discValue)
Description copied from interface:BeanType
Create a bean given the discriminator value.- Specified by:
createBeanUsingDisc
in interfaceBeanType<T>
-
addInheritanceWhere
public void addInheritanceWhere(Query<?> query)
Description copied from interface:BeanType
Add the discriminator value to the query if needed.- Specified by:
addInheritanceWhere
in interfaceBeanType<T>
-
isEmbedded
public boolean isEmbedded()
Return true if this is an embedded bean.
-
getIndexDefinitions
public IndexDefinition[] getIndexDefinitions()
Return the compound unique constraints.
-
getPersistListener
public BeanPersistListener getPersistListener()
Return the beanListener.- Specified by:
getPersistListener
in interfaceBeanType<T>
-
getBeanFinder
public BeanFindController getBeanFinder()
Return the beanFinder (Migrate over to getFindController).
-
getFindController
public BeanFindController getFindController()
Return the find controller (SPI interface).- Specified by:
getFindController
in interfaceBeanType<T>
-
getQueryAdapter
public BeanQueryAdapter getQueryAdapter()
Return the BeanQueryAdapter or null if none is defined.- Specified by:
getQueryAdapter
in interfaceBeanType<T>
-
deregister
public void deregister(BeanPersistListener listener)
De-register the BeanPersistListener.
-
deregister
public void deregister(BeanPersistController controller)
De-register the BeanPersistController.
-
register
public void register(BeanPersistListener newPersistListener)
Register the new BeanPersistController.
-
register
public void register(BeanPersistController newController)
Register the new BeanPersistController.
-
getPersistController
public BeanPersistController getPersistController()
Return the Controller.- Specified by:
getPersistController
in interfaceBeanType<T>
-
isRawSqlBased
public boolean isRawSqlBased()
Returns true if this bean is based on RawSql.- Specified by:
isRawSqlBased
in interfaceSTreeType
-
getDbComment
public String getDbComment()
Return the DB comment for the base table.
-
suppressForeignKey
public boolean suppressForeignKey()
Return true if foreign keys to the base table should be suppressed.
-
getPartitionMeta
public PartitionMeta getPartitionMeta()
Return the partition details of the bean.
-
getStorageEngine
public String getStorageEngine()
Return the storage engine.
-
getDependentTables
public String[] getDependentTables()
Return the dependent tables for a view based entity.These tables
-
getBaseTable
public String getBaseTable()
Return the base table. Only properties mapped to the base table are by default persisted.- Specified by:
getBaseTable
in interfaceBeanType<T>
-
isBaseTable
public boolean isBaseTable()
Return true if this type is a base table entity type.
-
getBaseTable
public String getBaseTable(SpiQuery.TemporalMode mode)
Return the base table to use given the query temporal mode.- Specified by:
getBaseTable
in interfaceSTreeType
-
getDraftTable
public String getDraftTable()
Return the associated draft table.
-
isReadAuditing
public boolean isReadAuditing()
Return true if read auditing is on this entity bean.
-
isSoftDelete
public boolean isSoftDelete()
Description copied from interface:STreeType
Return true if the type uses soft delete.- Specified by:
isSoftDelete
in interfaceSTreeType
-
setSoftDeleteValue
public void setSoftDeleteValue(EntityBean bean)
-
getSoftDeletePredicate
public String getSoftDeletePredicate(String tableAlias)
Description copied from interface:STreeType
Return the soft delete predicate using the given table alias.- Specified by:
getSoftDeletePredicate
in interfaceSTreeType
-
markAsDeleted
public void markAsDeleted(EntityBean bean)
Description copied from interface:STreeType
Mark the bean as deleted by setting the softDelete property to true. This works also, if there is only a virtual softDelete property computed by a formula. If there is no softdelete property, it sets the lazyLoadFailure flag in EBI.- Specified by:
markAsDeleted
in interfaceSTreeType
-
isDraftable
public boolean isDraftable()
Return true if this entity type is draftable.
-
isDraftableElement
public boolean isDraftableElement()
Return true if this entity type is a draftable element (child).
-
isEmbeddedPath
public boolean isEmbeddedPath(String propertyPath)
Description copied from interface:STreeType
Return true if the given path is an embedded bean.- Specified by:
isEmbeddedPath
in interfaceSTreeType
-
extraJoin
public ExtraJoin extraJoin(String propertyPath)
Description copied from interface:STreeType
Return an extra join if the property path requires it.
-
inheritanceLoad
public void inheritanceLoad(SqlBeanLoad sqlBeanLoad, STreeProperty property, DbReadContext ctx)
Description copied from interface:STreeType
Load the property taking into account inheritance.- Specified by:
inheritanceLoad
in interfaceSTreeType
-
setTenantId
public void setTenantId(EntityBean entityBean, Object tenantId)
Set the Tenant Id value to the bean.
-
setDraft
public void setDraft(EntityBean entityBean)
Set the draft to true for this entity bean instance. This bean is being loaded via asDraft() query.
-
isDraftInstance
public boolean isDraftInstance(EntityBean entityBean)
Return true if the bean is considered a 'draft' instance (not 'live').
-
isLiveInstance
public boolean isLiveInstance(EntityBean entityBean)
Return true if the bean is draftable and considered a 'live' instance.
-
setDraftDirty
public void setDraftDirty(EntityBean entityBean, boolean value)
If there is a @DraftDirty property set it's value on the bean.
-
draftQueryOptimise
public void draftQueryOptimise(Query<T> query)
Optimise the draft query fetching any draftable element relationships.
-
isHistorySupport
public boolean isHistorySupport()
Return true if this entity bean has history support.- Specified by:
isHistorySupport
in interfaceSTreeType
-
setGeneratedId
public void setGeneratedId(EntityBean entityBean, Transaction transaction)
Set the generated Id value if appropriate.
-
isIdGeneratedValue
public boolean isIdGeneratedValue()
Return true if the Id value is marked as a@GeneratedValue
.
-
getIdentityMode
public IdentityMode getIdentityMode()
-
getSelectLastInsertedId
public String getSelectLastInsertedId(boolean publish)
Return the SQL used to return the last inserted id.This is only used with Identity columns and getGeneratedKeys is not supported.
-
supportsSelectLastInsertedId
public boolean supportsSelectLastInsertedId()
Return true if this bean uses a SQL select to fetch the last inserted id value.
-
allProperties
@Nonnull public Collection<? extends Property> allProperties()
Description copied from interface:BeanType
Return all the properties for this bean type.- Specified by:
allProperties
in interfaceBeanType<T>
-
propertiesAll
public Collection<BeanProperty> propertiesAll()
Return a collection of all BeanProperty. This includes transient properties.
-
propertyUnmappedJson
public BeanProperty propertyUnmappedJson()
Return the property that holds unmapped JSON content.
-
propertiesNonTransient
public BeanProperty[] propertiesNonTransient()
Return the non transient non id properties.
-
propertiesTransient
public BeanProperty[] propertiesTransient()
Return the transient properties.
-
propertiesEmbedded
public BeanPropertyAssocOne<?>[] propertiesEmbedded()
Return the beans that are embedded. These share the base table with the owner bean.
-
includesAggregation
public boolean includesAggregation(OrmQueryDetail detail)
Return true if the query detail includes an aggregation property.
-
setAllLoaded
public void setAllLoaded(EntityBean bean)
Set all properties to be loaded (recurse to embedded beans).
-
getPrimaryKeyJoin
public TableJoin getPrimaryKeyJoin()
-
getIdProperty
public BeanProperty getIdProperty()
Description copied from interface:BeanType
Return the Id property.- Specified by:
getIdProperty
in interfaceBeanType<T>
-
isInsertMode
public boolean isInsertMode(EntityBeanIntercept ebi, boolean insertMode)
Return true if this bean should be inserted rather than updated.- Parameters:
ebi
- The entity bean interceptinsertMode
- true if the 'root request' was an insert rather than an update
-
isReference
public boolean isReference(EntityBeanIntercept ebi)
-
isIdLoaded
public boolean isIdLoaded(EntityBeanIntercept ebi)
-
setVersion
public long setVersion(EntityBean entityBean, Object versionValue)
Set the version value returning it in primitive long form.
-
getVersion
public long getVersion(EntityBean entityBean)
Return the version value in primitive long form (if exists and set).
-
checkMutableProperties
public void checkMutableProperties(EntityBeanIntercept ebi)
Check for mutable scalar types and mark as dirty if necessary.
-
getConcurrencyMode
public ConcurrencyMode getConcurrencyMode(EntityBeanIntercept ebi)
-
diff
public Map<String,ValuePair> diff(EntityBean newBean, EntityBean oldBean)
Return the diff comparing the bean values.
-
diff
public void diff(String prefix, Map<String,ValuePair> map, EntityBean newBean, EntityBean oldBean)
Populate the diff for updates with flattened non-null property values.
-
appendOrderById
public void appendOrderById(SpiQuery<T> query)
Appends the Id property to the OrderBy clause if it is not believed to be already contained in the order by.This is primarily used for paging queries to ensure that an order by clause is provided and that the order by provides unique ordering of the rows (so that the paging is predicable).
-
propsBaseScalar
public STreeProperty[] propsBaseScalar()
Description copied from interface:STreeType
Return the scalar properties.- Specified by:
propsBaseScalar
in interfaceSTreeType
-
propsEmbedded
public STreePropertyAssoc[] propsEmbedded()
Description copied from interface:STreeType
Return the embedded bean properties.- Specified by:
propsEmbedded
in interfaceSTreeType
-
propsOne
public STreePropertyAssocOne[] propsOne()
Description copied from interface:STreeType
Return the associated one properties.
-
propsMany
public STreePropertyAssocMany[] propsMany()
Description copied from interface:STreeType
Return the associated many properties.
-
propertiesOne
public BeanPropertyAssocOne<?>[] propertiesOne()
All the BeanPropertyAssocOne that are not embedded. These are effectively joined beans. For ManyToOne and OneToOne associations.
-
propertiesOneImported
public BeanPropertyAssocOne<?>[] propertiesOneImported()
Returns ManyToOnes and OneToOnes on the imported owning side.Excludes OneToOnes on the exported side.
-
propertiesOneImportedSave
public BeanPropertyAssocOne<?>[] propertiesOneImportedSave()
Imported Assoc Ones with cascade save true.
-
propertiesOneImportedDelete
public BeanPropertyAssocOne<?>[] propertiesOneImportedDelete()
Imported Assoc Ones with cascade delete true.
-
propertiesOneExportedSave
public BeanPropertyAssocOne<?>[] propertiesOneExportedSave()
Exported assoc ones with cascade save.
-
propertiesOneExportedDelete
public BeanPropertyAssocOne<?>[] propertiesOneExportedDelete()
Exported assoc ones with delete cascade.
-
propertiesNonMany
public BeanProperty[] propertiesNonMany()
All Non Assoc Many's for this descriptor.
-
propertiesMany
public BeanPropertyAssocMany<?>[] propertiesMany()
All Assoc Many's for this descriptor.
-
propertiesManySave
public BeanPropertyAssocMany<?>[] propertiesManySave()
Assoc Many's with save cascade.
-
propertiesManyDelete
public BeanPropertyAssocMany<?>[] propertiesManyDelete()
Assoc Many's with delete cascade.
-
propertiesManyToMany
public BeanPropertyAssocMany<?>[] propertiesManyToMany()
Assoc ManyToMany's.
-
getVersionProperty
public BeanProperty getVersionProperty()
Return the first version property that exists on the bean. Returns null if no version property exists on the bean.Note that this DOES NOT find a version property on an embedded bean.
-
isMultiTenant
public boolean isMultiTenant()
Return true if this type is tenant aware.
-
getTenantProperty
public BeanProperty getTenantProperty()
Return the tenant property when multi-tenant partitioning support is used.
-
propertiesBaseScalar
public BeanProperty[] propertiesBaseScalar()
Scalar properties without the unique id or secondary table properties.
-
propertiesLocal
public BeanProperty[] propertiesLocal()
Return the properties local to this type for inheritance.
-
propertiesGenInsert
public BeanProperty[] propertiesGenInsert()
Return the properties set as generated values on insert.
-
propertiesGenUpdate
public BeanProperty[] propertiesGenUpdate()
Return the properties set as generated values on update.
-
jsonWriteDirty
public void jsonWriteDirty(SpiJsonWriter writeJson, EntityBean bean, boolean[] dirtyProps) throws IOException
- Throws:
IOException
-
jsonWriteMapEntry
public void jsonWriteMapEntry(SpiJsonWriter ctx, Map.Entry<?,?> entry) throws IOException
- Throws:
IOException
-
jsonWriteElement
public void jsonWriteElement(SpiJsonWriter ctx, Object element)
-
jsonReadCollection
public Object jsonReadCollection(SpiJsonReader readJson, EntityBean parentBean) throws IOException
- Throws:
IOException
-
isJsonReadCollection
public boolean isJsonReadCollection()
-
jsonWrite
public void jsonWrite(SpiJsonWriter writeJson, EntityBean bean) throws IOException
- Throws:
IOException
-
jsonWrite
public void jsonWrite(SpiJsonWriter writeJson, EntityBean bean, String key) throws IOException
- Throws:
IOException
-
jsonRead
public T jsonRead(SpiJsonReader jsonRead, String path) throws IOException
- Throws:
IOException
-
getUniqueProps
public List<BeanProperty[]> getUniqueProps()
-
getInheritanceChildren
public List<BeanType<?>> getInheritanceChildren()
Description copied from interface:BeanType
Returns all direct children of this beantype- Specified by:
getInheritanceChildren
in interfaceBeanType<T>
-
getInheritanceParent
public BeanType<?> getInheritanceParent()
Description copied from interface:BeanType
Returns the parent in inheritance hiearchy- Specified by:
getInheritanceParent
in interfaceBeanType<T>
-
visitAllInheritanceChildren
public void visitAllInheritanceChildren(Consumer<BeanType<?>> visitor)
Description copied from interface:BeanType
Visit all children recursively- Specified by:
visitAllInheritanceChildren
in interfaceBeanType<T>
-
-