ENTITY - The type of the class being persisted.BUILDER - The type of the class that can construct new ENTITY instances.public class IndirectPrimaryKey<ENTITY,BUILDER> extends Object implements PrimaryKey<ENTITY,BUILDER>
Most users of hrorm will have no need to directly use this.
| Constructor and Description |
|---|
IndirectPrimaryKey(String prefix,
String name,
String sequenceName,
Function<ENTITY,Long> getter,
BiConsumer<BUILDER,Long> setter) |
| Modifier and Type | Method and Description |
|---|---|
Long |
getKey(ENTITY item) |
String |
getName()
The name of the database column this instance represents.
|
String |
getPrefix()
The prefix that should be used for this column when generating
SQL.
|
String |
getSequenceName()
The name of the database sequence that is used to populate this key
|
boolean |
isPrimaryKey()
Flag indicating whether or not this column is the primary key of the table
|
void |
notNull()
Calling this method will enforce a not-null constraint on this column.
|
void |
optimisticSetKey(ENTITY item,
Long id)
Sets the key onto the object
|
PopulateResult |
populate(BUILDER constructor,
ResultSet resultSet)
Populates the object with the data read from the database.
|
void |
setKey(BUILDER builder,
Long id) |
void |
setValue(ENTITY item,
int index,
PreparedStatement preparedStatement)
Sets a value onto the prepared statement based on the state of the object passed.
|
Set<Integer> |
supportedTypes()
The members of
java.sql.Types that this column should support. |
Column<ENTITY,BUILDER> |
withPrefix(String newPrefix,
Prefixer prefixer)
Make a new instance of the column, identical to this instance, except with a
new prefix.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitisParentColumnpublic String getSequenceName()
PrimaryKeygetSequenceName in interface PrimaryKey<ENTITY,BUILDER>public void setKey(BUILDER builder, Long id)
setKey in interface PrimaryKey<ENTITY,BUILDER>public void optimisticSetKey(ENTITY item, Long id)
PrimaryKeyoptimisticSetKey in interface PrimaryKey<ENTITY,BUILDER>item - the object whose key is to be setid - the primary key to assign itpublic String getName()
Columnpublic String getPrefix()
Columnpublic PopulateResult populate(BUILDER constructor, ResultSet resultSet) throws SQLException
Columnpopulate in interface Column<ENTITY,BUILDER>constructor - The object being populatedresultSet - The result said being readSQLException - allowed for ResultSet operationspublic void setValue(ENTITY item, int index, PreparedStatement preparedStatement) throws SQLException
ColumnsetValue in interface Column<ENTITY,BUILDER>item - The object to read the data from.index - Where in the prepared statement to set the read valuepreparedStatement - The statement being populatedSQLException - allowed for PreparedStatement operationspublic Column<ENTITY,BUILDER> withPrefix(String newPrefix, Prefixer prefixer)
ColumnwithPrefix in interface Column<ENTITY,BUILDER>newPrefix - The new prefixprefixer - The source for new prefixespublic boolean isPrimaryKey()
ColumnisPrimaryKey in interface Column<ENTITY,BUILDER>public void notNull()
ColumnCopyright © 2018. All rights reserved.