primaryKeyType
- Returns:
- the type of the primary key.
E - the type of the entity or projection.ID - the type of the primary key, or Void in case of a projection without a primary key.The Model is obtained via QueryTemplate.model(Class) or from a repository's
model() method. It can be used to introspect the database mapping of a record type, access column
metadata, check primary key defaults, and extract column values from record instances.
Model<User, Integer> model = orm.model(User.class);
String tableName = model.name();
List<Column> columns = model.columns();
columns()voidforEachValue(List<Column> columns,
E record,
BiConsumer<Column,Object> consumer) booleanname()schema()type()default SequencedMap<Column,Object> default SequencedMap<Column,Object> The returned list is deterministic and stable. Declared columns are processed in declaration order. Foreign relationships are expanded depth-first at the position of the foreign-key column.
Expanded columns always correspond to physical columns of the parent record. Join keys come from the parent row, not the referenced row.
Relationship expansion is not applied. The returned list preserves declared order.
Index semantics: Column.index() refers to the index in columns(),
not in this list.
This method is used to check if the primary key of the entity is a default value. This is useful when determining if the entity is new or has been persisted before.
pk - primary key to check.false otherwise.Values are JDBC-ready. Conversions have already been applied.
Ordering requirement: columns must be ordered according to the model's
column order (usually columns() or declaredColumns()).
columns - the columns to extract values for, ordered in model column order.record - the record to extract values from.consumer - receives each column and its extracted value.st.orm.core.template.SqlTemplateException - if extraction fails.Ordering requirement: columns must be ordered according to the model's
column order (usually columns() or declaredColumns()).
columns - the columns to extract values for.record - the record to extract values from.st.orm.core.template.SqlTemplateException - if extraction fails.This method is equivalent to values(List, Data) with columns().
record - the record to extract values from.st.orm.core.template.SqlTemplateException - if extraction fails.