
org.hibernate.jpa.internal.schemagen.GenerationSourceFromMetadata Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hibernate-entitymanager
Show all versions of hibernate-entitymanager
A module of the Hibernate O/RM project
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or .
*/
package org.hibernate.jpa.internal.schemagen;
import org.hibernate.boot.spi.MetadataImplementor;
import org.hibernate.dialect.Dialect;
import org.hibernate.tool.schema.internal.SchemaCreatorImpl;
import org.hibernate.tool.schema.internal.SchemaDropperImpl;
/**
* Handle schema generation source from (annotation/xml) metadata.
*
* @author Steve Ebersole
*/
public class GenerationSourceFromMetadata implements GenerationSource {
private final MetadataImplementor metadata;
private final Dialect dialect;
private final boolean createAndDropSchemas;
private final boolean creation;
public GenerationSourceFromMetadata(
MetadataImplementor metadata,
Dialect dialect,
boolean createAndDropSchemas,
boolean creation) {
this.metadata = metadata;
this.dialect = dialect;
this.createAndDropSchemas = createAndDropSchemas;
this.creation = creation;
}
@Override
public Iterable getCommands() {
if ( creation ) {
// for now...
return new SchemaCreatorImpl().generateCreationCommands( metadata, createAndDropSchemas, dialect );
}
else {
return new SchemaDropperImpl().generateDropCommands( metadata, createAndDropSchemas, dialect );
}
}
@Override
public void release() {
// nothing to do
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy