Package com.cockroachlabs.data.ddl
Class ComputedColumnHelper
java.lang.Object
com.cockroachlabs.data.ddl.ComputedColumnHelper
Generates CockroachDB DDL for computed columns annotated with
@ComputedColumn.-
Method Summary
Modifier and TypeMethodDescriptiongenerateDDL(String tableName, Class<?> entityClass) GenerateALTER TABLE ADD COLUMN ... AS (expr) STOREDDDL for all@ComputedColumn-annotated fields.static voidValidate that all@ComputedColumnannotations on the given class usestored = true.
-
Method Details
-
generateDDL
GenerateALTER TABLE ADD COLUMN ... AS (expr) STOREDDDL for all@ComputedColumn-annotated fields.- Parameters:
tableName- the SQL table nameentityClass- the JPA entity class to scan- Returns:
- list of DDL statements (may be empty)
- Throws:
IllegalArgumentException- if any field hasstored = false
-
validate
Validate that all@ComputedColumnannotations on the given class usestored = true.- Throws:
IllegalArgumentException- if any field hasstored = false
-