Class MappedEntity
- java.lang.Object
-
- com.feedzai.commons.sql.abstraction.engine.MappedEntity
-
- All Implemented Interfaces:
AutoCloseable
public class MappedEntity extends Object implements AutoCloseable
Mapped entity contains information about an entity that has been mapped using the engine.- Since:
- 2.0.0
- Author:
- Rui Vilao (rui.vilao@feedzai.com)
-
-
Constructor Summary
Constructors Constructor Description MappedEntity()Creates a new instance ofMappedEntity.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()StringgetAutoIncColumn()Gets the auto increment column.DbEntitygetEntity()Gets the entity.PreparedStatementgetInsert()Gets the prepared statement for inserts.PreparedStatementgetInsertReturning()Gets the prepared statement for inserts that retrieve the generated keys using the insert statement.PreparedStatementgetInsertWithAutoInc()Gets the insert statement with auto increment columns.booleanisSequenceDirty()Checks if a sequence is dirty.MappedEntitysetAutoIncColumn(String autoIncColumn)Sets the auto increment column.MappedEntitysetEntity(DbEntity entity)Sets the entity.MappedEntitysetInsert(PreparedStatement insert)Sets the insert statement.MappedEntitysetInsertReturning(PreparedStatement insertReturning)Sets the insert statement that allows returning the generated keys.MappedEntitysetInsertWithAutoInc(PreparedStatement insertWithAutoInc)Sets the insert statement auto inc columns.voidsetSequenceDirty(boolean sequenceDirty)Sets a sequence as dirty or not.
-
-
-
Constructor Detail
-
MappedEntity
public MappedEntity()
Creates a new instance ofMappedEntity.
-
-
Method Detail
-
setEntity
public MappedEntity setEntity(DbEntity entity)
Sets the entity.- Parameters:
entity- The entity.- Returns:
- This mapped entity
-
setInsert
public MappedEntity setInsert(PreparedStatement insert)
Sets the insert statement.- Parameters:
insert- The insert statement.- Returns:
- This mapped entity
-
getEntity
public DbEntity getEntity()
Gets the entity.- Returns:
- The entity.
-
getInsert
public PreparedStatement getInsert()
Gets the prepared statement for inserts.- Returns:
- The prepared statement for inserts.
-
getInsertReturning
public PreparedStatement getInsertReturning()
Gets the prepared statement for inserts that retrieve the generated keys using the insert statement.- Returns:
- The insert statement that allows returning the generated keys.
-
setInsertReturning
public MappedEntity setInsertReturning(PreparedStatement insertReturning)
Sets the insert statement that allows returning the generated keys.- Parameters:
insertReturning- The insert statement that allows returning the generated keys- Returns:
- This mapped entity
-
getInsertWithAutoInc
public PreparedStatement getInsertWithAutoInc()
Gets the insert statement with auto increment columns.- Returns:
- The insert statement with auto increment columns.
- See Also:
DatabaseEngine.persist(String, EntityEntry, boolean)
-
setInsertWithAutoInc
public MappedEntity setInsertWithAutoInc(PreparedStatement insertWithAutoInc)
Sets the insert statement auto inc columns.- Parameters:
insertWithAutoInc- The insert statement with auto inc columns.- Returns:
- This mapped entity;
- See Also:
DatabaseEngine.persist(String, EntityEntry, boolean)
-
getAutoIncColumn
public String getAutoIncColumn()
Gets the auto increment column.- Returns:
- The auto increment column.
-
setAutoIncColumn
public MappedEntity setAutoIncColumn(String autoIncColumn)
Sets the auto increment column.- Parameters:
autoIncColumn- the auto increment column.- Returns:
- This mapped entity.
-
isSequenceDirty
public boolean isSequenceDirty()
Checks if a sequence is dirty. A sequence is dirty only if it was potentially marked as so and there's an auto increment column set.- Returns:
trueif the sequence is dirty,falseotherwise.
-
setSequenceDirty
public void setSequenceDirty(boolean sequenceDirty)
Sets a sequence as dirty or not.- Parameters:
sequenceDirty- The flag signaling the status of the sequence.
-
close
public void close() throws Exception- Specified by:
closein interfaceAutoCloseable- Throws:
Exception
-
-