Skip to content

Instantly share code, notes, and snippets.

@treaz treaz/Provider.java
Created Aug 23, 2018

Embed
What would you like to do?
package com.horiaconstantin;
import org.hibernate.boot.model.relational.Namespace;
import org.hibernate.boot.model.relational.Sequence;
import org.hibernate.mapping.Table;
import org.hibernate.tool.schema.spi.SchemaFilter;
import org.hibernate.tool.schema.spi.SchemaFilterProvider;
public class Provider implements SchemaFilterProvider {
@Override
public SchemaFilter getCreateFilter() {
return MySchemaFilter.INSTANCE;
}
@Override
public SchemaFilter getDropFilter() {
return MySchemaFilter.INSTANCE;
}
@Override
public SchemaFilter getMigrateFilter() {
return MySchemaFilter.INSTANCE;
}
@Override
public SchemaFilter getValidateFilter() {
return MySchemaFilter.INSTANCE;
}
}
class MySchemaFilter implements SchemaFilter {
public static final MySchemaFilter INSTANCE = new MySchemaFilter();
@Override
public boolean includeNamespace(Namespace namespace) {
return true;
}
@Override
public boolean includeTable(Table table) {
if (table.getName().toLowerCase().contains("namespace")){
return false;
}
return true;
}
@Override
public boolean includeSequence(Sequence sequence) {
return true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.