本文整理了Java中org.hibernate.mapping.Table.setSchema()
方法的一些代码示例,展示了Table.setSchema()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Table.setSchema()
方法的具体详情如下:
包路径:org.hibernate.mapping.Table
类名称:Table
方法名:setSchema
暂无
代码示例来源:origin: org.hibernate/hibernate-tools
private static void bindTables(List<?> tables, OverrideRepository repository) {
Iterator<?> iterator = tables.iterator();
while ( iterator.hasNext() ) {
Element element = (Element) iterator.next();
Table table = new Table();
table.setCatalog( element.attributeValue("catalog") );
table.setSchema( element.attributeValue("schema") );
table.setName( element.attributeValue("name") );
String wantedClassName = element.attributeValue("class");
Element primaryKey = element.element("primary-key");
bindPrimaryKey(primaryKey, table, repository);
List<?> columns = element.elements("column");
bindColumns(columns, table, repository);
List<?> foreignKeys = element.elements("foreign-key");
bindForeignKeys(foreignKeys, table, repository);
bindMetaAttributes(element, table, repository);
repository.addTable(table,wantedClassName);
}
}
代码示例来源:origin: stackoverflow.com
@Override
protected SessionFactory buildSessionFactory(LocalSessionFactoryBuilder sfb) {
sfb.buildMappings();
// For my task we need this
Iterator<Table> iterator = getConfiguration().getTableMappings();
while (iterator.hasNext()){
Table table = iterator.next();
if(table.getSchema() != null && !table.getSchema().isEmpty()){
table.setSchema(schemaConfigurator.getSchemaName(table.getSchema()));
}
}
return super.buildSessionFactory(sfb);
}
代码示例来源:origin: org.hibernate/hibernate-tools
foreignTable.setName(foreignTableName);
foreignTable.setCatalog(getValue(element.attributeValue( "foreign-catalog"), table.getCatalog()) );
foreignTable.setSchema(getValue(element.attributeValue( "foreign-schema"), table.getSchema()) );
代码示例来源:origin: org.hibernate/hibernate-tools
public Table addTable(String schema,
String catalog,
String name) {
String key = TableNameQualifier.qualify(quote(catalog), quote(schema), quote(name));
Table table = (Table) tables.get(key);
if (table == null) {
table = new Table();
table.setAbstract(false);
table.setName(name);
table.setSchema(schema);
table.setCatalog(catalog);
tables.put(key, table);
String qualifier = StringHelper.qualifier(key);
List<Table> schemaList = qualifiers.get(qualifier);
if(schemaList==null) {
schemaList = new ArrayList<Table>();
qualifiers.put(qualifier, schemaList);
}
schemaList.add(table);
}
else {
table.setAbstract(false);
}
return table;
}
代码示例来源:origin: hibernate/hibernate-tools
public Table addTable(String schema,
String catalog,
String name) {
String key = TableNameQualifier.qualify(quote(catalog), quote(schema), quote(name));
Table table = (Table) tables.get(key);
if (table == null) {
table = new Table();
table.setAbstract(false);
table.setName(name);
table.setSchema(schema);
table.setCatalog(catalog);
tables.put(key, table);
String qualifier = StringHelper.qualifier(key);
List<Table> schemaList = qualifiers.get(qualifier);
if(schemaList==null) {
schemaList = new ArrayList<Table>();
qualifiers.put(qualifier, schemaList);
}
schemaList.add(table);
}
else {
table.setAbstract(false);
}
return table;
}
代码示例来源:origin: org.beangle.commons/beangle-commons-orm
/**
* Config table's schema by TableNamingStrategy
*/
private void configSchema() {
TableNamingStrategy namingStrategy = null;
if (getNamingStrategy() instanceof RailsNamingStrategy) {
namingStrategy = ((RailsNamingStrategy) getNamingStrategy()).getTableNamingStrategy();
}
if (null == namingStrategy) return;
else {
// Update SeqGenerator's static variable.
// Because generator is init by hibernate,cannot inject namingStrategy.
TableSeqGenerator.namingStrategy = namingStrategy;
}
if (namingStrategy.isMultiSchema()) {
for (PersistentClass clazz : classes.values()) {
String schema = namingStrategy.getSchema(clazz.getEntityName());
if (null != schema) clazz.getTable().setSchema(schema);
}
for (Collection collection : collections.values()) {
final Table table = collection.getCollectionTable();
if (null == table) continue;
String schema = namingStrategy.getSchema(collection.getRole());
if (null != schema) table.setSchema(schema);
}
}
}
代码示例来源:origin: hibernate/hibernate
public Table addDenormalizedTable(
String schema,
String catalog,
String name,
boolean isAbstract,
String subselect,
Table includedTable)
throws MappingException {
String key = subselect==null ?
Table.qualify(catalog, schema, name, '.') :
subselect;
if ( tables.containsKey(key) ) {
throw new MappingException("duplicate table: " + name);
}
Table table = new DenormalizedTable(includedTable);
table.setAbstract(isAbstract);
table.setName(name);
table.setSchema(schema);
table.setCatalog(catalog);
table.setSubselect(subselect);
tables.put(key, table);
return table;
}
代码示例来源:origin: jboss.jboss-embeddable-ejb3/hibernate-all
public Table addDenormalizedTable(
String schema,
String catalog,
String name,
boolean isAbstract,
String subselect,
Table includedTable)
throws MappingException {
String key = subselect==null ?
Table.qualify(catalog, schema, name) :
subselect;
if ( tables.containsKey(key) ) {
throw new DuplicateMappingException("table", name);
}
Table table = new DenormalizedTable(includedTable);
table.setAbstract(isAbstract);
table.setName(name);
table.setSchema(schema);
table.setCatalog(catalog);
table.setSubselect(subselect);
tables.put(key, table);
return table;
}
代码示例来源:origin: hibernate/hibernate
public Table addTable(String schema,
String catalog,
String name,
String subselect,
boolean isAbstract
) {
String key = subselect==null ?
Table.qualify(catalog, schema, name, '.') :
subselect;
Table table = (Table) tables.get(key);
if (table == null) {
table = new Table();
table.setAbstract(isAbstract);
table.setName(name);
table.setSchema(schema);
table.setCatalog(catalog);
table.setSubselect(subselect);
tables.put(key, table);
}
else {
if (!isAbstract) table.setAbstract(false);
}
return table;
}
代码示例来源:origin: jboss.jboss-embeddable-ejb3/hibernate-all
public Table addTable(String schema,
String catalog,
String name,
String subselect,
boolean isAbstract
) {
String key = subselect==null ?
Table.qualify(catalog, schema, name) :
subselect;
Table table = (Table) tables.get(key);
if (table == null) {
table = new Table();
table.setAbstract(isAbstract);
table.setName(name);
table.setSchema(schema);
table.setCatalog(catalog);
table.setSubselect(subselect);
tables.put(key, table);
}
else {
if (!isAbstract) table.setAbstract(false);
}
return table;
}
代码示例来源:origin: hibernate/hibernate-tools
element.getAttribute("foreign-catalog") :
table.getCatalog());
foreignTable.setSchema(
element.hasAttribute("foreign-schema") ?
element.getAttribute("foreign-schema") :
代码示例来源:origin: hibernate/hibernate-tools
.getProperty(AvailableSettings.DEFAULT_SCHEMA);
PersistentClass orders = metadata.getEntityBinding(PACKAGE_NAME + ".Orders");
orders.getTable().setSchema(schemaToUse);
PersistentClass items = metadata.getEntityBinding(PACKAGE_NAME + ".Item");
items.getTable().setSchema(schemaToUse);
代码示例来源:origin: org.hibernate/com.springsource.org.hibernate.core
public Table addDenormalizedTable(
String schema,
String catalog,
String name,
boolean isAbstract,
String subselect,
Table includedTable) throws DuplicateMappingException {
name = getObjectNameNormalizer().normalizeIdentifierQuoting( name );
schema = getObjectNameNormalizer().normalizeIdentifierQuoting( schema );
catalog = getObjectNameNormalizer().normalizeIdentifierQuoting( catalog );
String key = subselect == null ? Table.qualify(catalog, schema, name) : subselect;
if ( tables.containsKey( key ) ) {
throw new DuplicateMappingException( "table", name );
}
Table table = new DenormalizedTable( includedTable );
table.setAbstract( isAbstract );
table.setName( name );
table.setSchema( schema );
table.setCatalog( catalog );
table.setSubselect( subselect );
tables.put( key, table );
return table;
}
代码示例来源:origin: org.hibernate/com.springsource.org.hibernate
public Table addDenormalizedTable(
String schema,
String catalog,
String name,
boolean isAbstract,
String subselect,
Table includedTable) throws DuplicateMappingException {
name = getObjectNameNormalizer().normalizeIdentifierQuoting( name );
schema = getObjectNameNormalizer().normalizeIdentifierQuoting( schema );
catalog = getObjectNameNormalizer().normalizeIdentifierQuoting( catalog );
String key = subselect == null ? Table.qualify(catalog, schema, name) : subselect;
if ( tables.containsKey( key ) ) {
throw new DuplicateMappingException( "table", name );
}
Table table = new DenormalizedTable( includedTable );
table.setAbstract( isAbstract );
table.setName( name );
table.setSchema( schema );
table.setCatalog( catalog );
table.setSubselect( subselect );
tables.put( key, table );
return table;
}
代码示例来源:origin: hibernate/hibernate-tools
private static void bindTables(
ArrayList<Element> tables,
OverrideRepository repository) {
for (Element element : tables) {
Table table = new Table();
table.setCatalog(getAttribute(element, "catalog"));
table.setSchema(getAttribute(element, "schema"));
table.setName(getAttribute(element, "name"));
ArrayList<Element> primaryKeys = getChildElements(element, "primary-key");
if (primaryKeys.size() > 0) {
bindPrimaryKey(primaryKeys.get(0), table, repository);
}
bindColumns(getChildElements(element, "column"), table, repository);
bindForeignKeys(getChildElements(element, "foreign-key"), table, repository);
bindMetaAttributes(element, table, repository);
repository.addTable(table, getAttribute(element, "class"));
}
}
代码示例来源:origin: org.hibernate/com.springsource.org.hibernate
public Table addTable(
String schema,
String catalog,
String name,
String subselect,
boolean isAbstract) {
name = getObjectNameNormalizer().normalizeIdentifierQuoting( name );
schema = getObjectNameNormalizer().normalizeIdentifierQuoting( schema );
catalog = getObjectNameNormalizer().normalizeIdentifierQuoting( catalog );
String key = subselect == null ? Table.qualify( catalog, schema, name ) : subselect;
Table table = tables.get( key );
if ( table == null ) {
table = new Table();
table.setAbstract( isAbstract );
table.setName( name );
table.setSchema( schema );
table.setCatalog( catalog );
table.setSubselect( subselect );
tables.put( key, table );
}
else {
if ( !isAbstract ) {
table.setAbstract( false );
}
}
return table;
}
代码示例来源:origin: org.hibernate/com.springsource.org.hibernate.core
public Table addTable(
String schema,
String catalog,
String name,
String subselect,
boolean isAbstract) {
name = getObjectNameNormalizer().normalizeIdentifierQuoting( name );
schema = getObjectNameNormalizer().normalizeIdentifierQuoting( schema );
catalog = getObjectNameNormalizer().normalizeIdentifierQuoting( catalog );
String key = subselect == null ? Table.qualify( catalog, schema, name ) : subselect;
Table table = tables.get( key );
if ( table == null ) {
table = new Table();
table.setAbstract( isAbstract );
table.setName( name );
table.setSchema( schema );
table.setCatalog( catalog );
table.setSubselect( subselect );
tables.put( key, table );
}
else {
if ( !isAbstract ) {
table.setAbstract( false );
}
}
return table;
}
代码示例来源:origin: org.hibernate/com.springsource.org.hibernate
public boolean isTable(Object key) throws HibernateException {
if(key instanceof String) {
Table tbl = new Table((String)key);
if ( getTableMetadata( tbl.getName(), tbl.getSchema(), tbl.getCatalog(), tbl.isQuoted() ) != null ) {
return true;
} else {
String[] strings = StringHelper.split(".", (String) key);
if(strings.length==3) {
tbl = new Table(strings[2]);
tbl.setCatalog(strings[0]);
tbl.setSchema(strings[1]);
return getTableMetadata( tbl.getName(), tbl.getSchema(), tbl.getCatalog(), tbl.isQuoted() ) != null;
} else if (strings.length==2) {
tbl = new Table(strings[1]);
tbl.setSchema(strings[0]);
return getTableMetadata( tbl.getName(), tbl.getSchema(), tbl.getCatalog(), tbl.isQuoted() ) != null;
}
}
}
return false;
}
代码示例来源:origin: org.hibernate/com.springsource.org.hibernate.core
public boolean isTable(Object key) throws HibernateException {
if(key instanceof String) {
Table tbl = new Table((String)key);
if ( getTableMetadata( tbl.getName(), tbl.getSchema(), tbl.getCatalog(), tbl.isQuoted() ) != null ) {
return true;
} else {
String[] strings = StringHelper.split(".", (String) key);
if(strings.length==3) {
tbl = new Table(strings[2]);
tbl.setCatalog(strings[0]);
tbl.setSchema(strings[1]);
return getTableMetadata( tbl.getName(), tbl.getSchema(), tbl.getCatalog(), tbl.isQuoted() ) != null;
} else if (strings.length==2) {
tbl = new Table(strings[1]);
tbl.setSchema(strings[0]);
return getTableMetadata( tbl.getName(), tbl.getSchema(), tbl.getCatalog(), tbl.isQuoted() ) != null;
}
}
}
return false;
}
代码示例来源:origin: Jasig/uPortal
tbl = new Table(strings[2]);
tbl.setCatalog(strings[0]);
tbl.setSchema(strings[1]);
return getTableMetadata(
tbl.getName(),
} else if (strings.length == 2) {
tbl = new Table(strings[1]);
tbl.setSchema(strings[0]);
return getTableMetadata(
tbl.getName(),
内容来源于网络,如有侵权,请联系作者删除!