HHH-7957 - Integrate Public Review Draft of the JPA 2.1 spec : schema generation

This commit is contained in:
Steve Ebersole 2013-02-03 18:03:55 -06:00
parent 9ab924041d
commit a3083aaa7b
2 changed files with 13 additions and 18 deletions

View File

@ -95,14 +95,4 @@ public interface PersistentIdentifierGenerator extends IdentifierGenerator {
* @return Object an identifying key for this generator * @return Object an identifying key for this generator
*/ */
public Object generatorKey(); public Object generatorKey();
public String getSchema();
public String getCatalog();
} }

View File

@ -345,6 +345,11 @@ public class JpaSchemaGenerator {
private final List<String> commands; private final List<String> commands;
private CreateSchemaCommandSource(Configuration hibernateConfiguration, Dialect dialect) { private CreateSchemaCommandSource(Configuration hibernateConfiguration, Dialect dialect) {
// NOTES:
// 1) catalogs are currently not handled here at all
// 2) schemas for sequences are not handled here at all
// Both of these are handle-able on the metamodel codebase
final HashSet<String> schemas = new HashSet<String>(); final HashSet<String> schemas = new HashSet<String>();
// final HashSet<String> catalogs = new HashSet<String>(); // final HashSet<String> catalogs = new HashSet<String>();
@ -355,14 +360,14 @@ public class JpaSchemaGenerator {
schemas.add( table.getSchema() ); schemas.add( table.getSchema() );
} }
final Iterator<IdentifierGenerator> generators = hibernateConfiguration.iterateGenerators( dialect ); // final Iterator<IdentifierGenerator> generators = hibernateConfiguration.iterateGenerators( dialect );
while ( generators.hasNext() ) { // while ( generators.hasNext() ) {
final IdentifierGenerator generator = generators.next(); // final IdentifierGenerator generator = generators.next();
if ( PersistentIdentifierGenerator.class.isInstance( generator ) ) { // if ( PersistentIdentifierGenerator.class.isInstance( generator ) ) {
// catalogs.add( ( (PersistentIdentifierGenerator) generator ).getCatalog() ); //// catalogs.add( ( (PersistentIdentifierGenerator) generator ).getCatalog() );
schemas.add( ( (PersistentIdentifierGenerator) generator ).getCatalog() ); // schemas.add( ( (PersistentIdentifierGenerator) generator ).getSchema() );
} // }
} // }
// if ( schemas.isEmpty() && catalogs.isEmpty() ) { // if ( schemas.isEmpty() && catalogs.isEmpty() ) {
if ( schemas.isEmpty() ) { if ( schemas.isEmpty() ) {