public class SpannerSchemaUtils extends Object
Constructor and Description |
---|
SpannerSchemaUtils(SpannerMappingContext mappingContext,
SpannerEntityProcessor spannerEntityProcessor,
boolean createInterleavedTableDdlOnDeleteCascade)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
<T> String |
getCreateTableDdlString(Class<T> entityClass)
Gets the DDL string to create the table for the given entity in Cloud Spanner.
|
List<String> |
getCreateTableDdlStringsForInterleavedHierarchy(Class entityClass)
Gets a list of DDL strings to create the tables rooted at the given entity class.
|
String |
getDropTableDdlString(Class entityClass)
Gets the DDL string to drop the table for the given entity in Cloud Spanner.
|
List<String> |
getDropTableDdlStringsForInterleavedHierarchy(Class entityClass)
Gets the DDL strings to drop the tables of this entity and all of its sub-entities.
|
Key |
getKey(Object object)
Gets the key for the given object.
|
public SpannerSchemaUtils(SpannerMappingContext mappingContext, SpannerEntityProcessor spannerEntityProcessor, boolean createInterleavedTableDdlOnDeleteCascade)
mappingContext
- a mapping context used to obtain persistent entity metadata
for generating DDL statements.spannerEntityProcessor
- an entity processor that is queried for types that it
can convert for determining compatible column types when generating DDL statements.createInterleavedTableDdlOnDeleteCascade
- if true
will generate
create-table statements that specify cascade on delete for interleaved tables. If
false
, then the deletes among interleaved tables do not cascade and require
manual deletion of all children before parents.public String getDropTableDdlString(Class entityClass)
entityClass
- the entity type.public Key getKey(Object object)
object
- the object to get the key forpublic <T> String getCreateTableDdlString(Class<T> entityClass)
T
- the type of the entity classentityClass
- the entity type.public List<String> getCreateTableDdlStringsForInterleavedHierarchy(Class entityClass)
entityClass
- the root class for which to get create strings.public List<String> getDropTableDdlStringsForInterleavedHierarchy(Class entityClass)
entityClass
- the root entity whose table to drop.Copyright © 2020 Pivotal Software, Inc.. All rights reserved.