This annotation can be applied to fields or methods in an entity class.
Attributes:
- `value`: Specifies the name of the column this field or method maps to in the database.
- `joinOn`: Indicates the condition used when performing a join operation on another table.
- `joinUsing`: Specifies whether the join should use the field's value as part of a "using" clause.
- `generator`: References a custom ColumnValueGenerator implementation to dynamically compute or fetch the column value.
- `generateUsingSequence`: Specifies the name of a database sequence to use for generating the column value.
Example Use Cases: - Static column mapping using the `value` attribute for straightforward entity-table mapping. - Dynamic column value generation through the `generator` attribute. - Sequence-based value generation for primary key fields using the `generateUsingSequence` attribute.
Note: - The `ColumnValueGenerator` referenced in the `generator` attribute provides a functional interface for computing the column's value at runtime using metadata information. - A blank or default value for an attribute signals that the feature is not applicable or disabled.
-
Required Element Summary
Required Elements -
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionSpecifies the database sequence to be used for generating values for the annotated field or method.Class<? extends ColumnValueGenerator> Specifies a custom implementation ofColumnValueGeneratorto dynamically generate or compute values for the database column during runtime.The remote column name to which this column is joined.booleanJoin using the the current column's name.
-
Element Details
-
value
String valueSpecifies the name of the database column that the annotated field or method maps to.This value is used for static column mapping in the Litebridge ORM.
- Returns:
- The name of the column in the database table.
-
joinOn
String joinOnThe remote column name to which this column is joined.Only the column name should be specified; the table is inferred from the field type.
- Returns:
- The join column name as a string. If left empty or not specified, no join condition is associated with this column.
- Default:
""
-
joinUsing
boolean joinUsingJoin using the the current column's name.Indicates that the mapping should use the current column's name as part of a "USING" clause when performing a SQL join operation.
- Returns:
- true if the "using" clause should be applied; false otherwise.
- Default:
false
-
generator
Class<? extends ColumnValueGenerator> generatorSpecifies a custom implementation ofColumnValueGeneratorto dynamically generate or compute values for the database column during runtime. This attribute allows for overriding the default behavior of static column value assignment by providing a generator class that implements the logic for value computation.- Returns:
- A class that extends
ColumnValueGenerator, which will be used to generate the column value. If not specified, the default isColumnValueGenerator.class, indicating no custom generator is used. The class must have a no-argument constructor.
- Default:
org.litebridge.db.spi.generator.ColumnValueGenerator.class
-
generateUsingSequence
String generateUsingSequenceSpecifies the database sequence to be used for generating values for the annotated field or method. When provided, this sequence will be used to automatically populate the column value during insert operations.- Returns:
- The name of the database sequence to use. If not specified, no sequence will be used.
- Default:
""
-