public abstract class EntitySqlGenerator extends Object implements Closeable
GeneratorDialect.| Constructor and Description |
|---|
EntitySqlGenerator(GeneratorContext context) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Writes any missing SQL and closes any open resources.
|
protected <E> boolean |
findEntity(E entity)
Tries to find an entity in an online store.
|
GeneratorContext |
getContext()
Used to keep the state of indices and to store any configuration.
|
<E> void |
markExistingEntities(Iterable<E> entities)
Marks a set of entity references, where we don't know the ID in the database.
|
<E> void |
markExistingEntity(E entity,
Number id)
Marks an entity reference, where we know the ID in the database.
|
<E> void |
write(E entity)
Creates the Import-SQL for an entity.
|
<E> void |
write(Iterable<? extends E> entities)
Creates the SQL for the given entities.
|
void |
writeAlignmentStatements()
Writes all statements that are necessary to align ID generators in the database with the current IDs.
|
abstract void |
writeComment(String comment)
Writes a SQL comment to the target.
|
abstract void |
writeSectionSeparator()
Writes a new line to the target to separate different sections in the SQL file.
|
abstract void |
writeStatement(EntityStatement stmt)
Writes the given statement to the target.
|
@ConstructorProperties(value="context") @Generated(value="lombok") public EntitySqlGenerator(GeneratorContext context)
public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOException - if the target writer throws oneprotected <E> boolean findEntity(E entity)
throws IOException
entity - the entity to checktrue if the entity was found and has an id nowIOException - if something wents wrongpublic <E> void markExistingEntities(Iterable<E> entities) throws IOException
entities - the entity to ignore during write(Object)IOException - if the writer throws onepublic <E> void markExistingEntity(E entity,
Number id)
markExistingEntities(Iterable), we know the id for the given entity.entity - the entity to ignore during write(Object)id - the id of the entity inpublic <E> void write(E entity)
throws IOException
entity - the entity to create the SQL forIOException - if the writer throws oneIllegalArgumentException - if the entity is invalidpublic <E> void write(Iterable<? extends E> entities) throws IOException
entities - the entities for SQL creationIOException - if the writer throws onepublic void writeAlignmentStatements()
throws IOException
IOException - if the target writer throws onepublic abstract void writeComment(String comment) throws IOException
comment - the comment to writeIOException - if the target throws onepublic abstract void writeSectionSeparator()
throws IOException
IOException - if the target throws such an exceptionpublic abstract void writeStatement(EntityStatement stmt) throws IOException
stmt - the SQL statement to writeIOException - if the target throws one@Generated(value="lombok") public GeneratorContext getContext()
Copyright © 2017 fastnate.org. All rights reserved.