本文整理了Java中org.hibernate.mapping.Table.getSchema()
方法的一些代码示例,展示了Table.getSchema()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Table.getSchema()
方法的具体详情如下:
包路径:org.hibernate.mapping.Table
类名称:Table
方法名:getSchema
暂无
代码示例来源:origin: hibernate/hibernate-orm
public String toString() {
StringBuilder buf = new StringBuilder().append( getClass().getName() )
.append( '(' );
if ( getCatalog() != null ) {
buf.append( getCatalog() ).append( "." );
}
if ( getSchema() != null ) {
buf.append( getSchema() ).append( "." );
}
buf.append( getName() ).append( ')' );
return buf.toString();
}
代码示例来源:origin: hibernate/hibernate-orm
protected String getSchema(String schemaFromAnnotation, Table table) {
// Get the schema from the annotation ...
String schema = schemaFromAnnotation;
// ... if empty, try using the default ...
if ( StringTools.isEmpty( schema ) ) {
schema = globalCfg.getDefaultSchemaName();
// ... if still empty, use the same as the normal table.
if ( StringTools.isEmpty( schema ) ) {
schema = table.getSchema();
}
}
return schema;
}
代码示例来源:origin: hibernate/hibernate-orm
annotations,
table.getCatalog(),
table.getSchema(),
table.getName(),
Boolean.valueOf( typeParameters.getProperty( DynamicParameterizedType.IS_PRIMARY_KEY ) ),
代码示例来源:origin: hibernate/hibernate-orm
@Override
public String[] getSqlDropStrings(Table table, Metadata metadata) {
StringBuilder buf = new StringBuilder( "drop table " );
if ( dialect.supportsIfExistsBeforeTableName() ) {
buf.append( "if exists " );
}
final QualifiedName tableName = new QualifiedNameParser.NameParts(
Identifier.toIdentifier( table.getCatalog(), table.isCatalogQuoted() ),
Identifier.toIdentifier( table.getSchema(), table.isSchemaQuoted() ),
table.getNameIdentifier()
);
final JdbcEnvironment jdbcEnvironment = metadata.getDatabase().getJdbcEnvironment();
buf.append( jdbcEnvironment.getQualifiedObjectNameFormatter().format( tableName, jdbcEnvironment.getDialect() ) )
.append( dialect.getCascadeConstraintsString() );
if ( dialect.supportsIfExistsAfterTableName() ) {
buf.append( " if exists" );
}
return new String[] { buf.toString() };
}
}
代码示例来源:origin: hibernate/hibernate-orm
@Test
public void testRevinfoSchemaName() {
Table revisionTable = metadata().getEntityBinding( "org.hibernate.envers.enhanced.SequenceIdRevisionEntity" )
.getTable();
assert SCHEMA_NAME.equals( revisionTable.getSchema() );
}
代码示例来源:origin: hibernate/hibernate-orm
@Override
public void addSecondaryTable(QualifiedTableName logicalQualifiedTableName, Join secondaryTableJoin) {
Identifier logicalName = logicalQualifiedTableName.getTableName();
if ( Identifier.areEqual(
Identifier.toIdentifier(
new QualifiedTableName(
Identifier.toIdentifier( primaryTable.getCatalog() ),
Identifier.toIdentifier( primaryTable.getSchema() ),
primaryTableLogicalName
).render()
),
Identifier.toIdentifier( logicalQualifiedTableName.render() ) ) ) {
throw new DuplicateSecondaryTableException( logicalName );
}
if ( secondaryTableJoinMap == null ) {
//secondaryTableJoinMap = new HashMap<Identifier,Join>();
//secondaryTableJoinMap.put( logicalName, secondaryTableJoin );
secondaryTableJoinMap = new HashMap<>();
secondaryTableJoinMap.put( logicalName.getCanonicalName(), secondaryTableJoin );
}
else {
//final Join existing = secondaryTableJoinMap.put( logicalName, secondaryTableJoin );
final Join existing = secondaryTableJoinMap.put( logicalName.getCanonicalName(), secondaryTableJoin );
if ( existing != null ) {
throw new DuplicateSecondaryTableException( logicalName );
}
}
}
代码示例来源:origin: hibernate/hibernate-orm
final QualifiedName tableName = new QualifiedNameParser.NameParts(
Identifier.toIdentifier( table.getCatalog(), table.isCatalogQuoted() ),
Identifier.toIdentifier( table.getSchema(), table.isSchemaQuoted() ),
table.getNameIdentifier()
);
代码示例来源:origin: hibernate/hibernate-orm
@Test
public void testJoinTableSchemaName() {
for ( Table table : metadata().collectTableMappings() ) {
if ( TABLE_NAME.equals( table.getName() ) ) {
Assert.assertEquals( SCHEMA_NAME, table.getSchema() );
return;
}
}
Assert.fail();
}
代码示例来源:origin: hibernate/hibernate-orm
@Test
public void testNoCircularityDetection() {
StandardServiceRegistry ssr = new StandardServiceRegistryBuilder().build();
try {
final Metadata metadata = new MetadataSources( ssr )
.addAnnotatedClass( Entity1.class )
.addAnnotatedClass( Entity2.class )
.buildMetadata();
org.hibernate.mapping.Table entity1Table = metadata.getEntityBinding( Entity1.class.getName() ).getTable();
org.hibernate.mapping.Table entity2Table = metadata.getEntityBinding( Entity2.class.getName() ).getTable();
assertTrue( entity1Table.getName().equals( entity2Table.getName() ) );
assertFalse( entity1Table.getSchema().equals( entity2Table.getSchema() ) );
}
finally {
StandardServiceRegistryBuilder.destroy( ssr );
}
}
代码示例来源:origin: org.hibernate/hibernate-annotations
typeParameters = new Properties();
typeParameters.setProperty( EnumType.ENUM, returnedClassOrElement.getName() );
String schema = columns[0].getTable().getSchema();
schema = schema == null ? "" : schema;
String catalog = columns[0].getTable().getCatalog();
代码示例来源:origin: org.hibernate.orm/hibernate-core
public String toString() {
StringBuilder buf = new StringBuilder().append( getClass().getName() )
.append( '(' );
if ( getCatalog() != null ) {
buf.append( getCatalog() ).append( "." );
}
if ( getSchema() != null ) {
buf.append( getSchema() ).append( "." );
}
buf.append( getName() ).append( ')' );
return buf.toString();
}
代码示例来源:origin: hibernate/hibernate
public String toString() {
StringBuffer buf = new StringBuffer().append( getClass().getName() )
.append('(');
if ( getCatalog()!=null ) buf.append( getCatalog() + "." );
if ( getSchema()!=null ) buf.append( getSchema()+ ".");
buf.append( getName() ).append(')');
return buf.toString();
}
代码示例来源:origin: hibernate/hibernate-tools
public Object accept(Set o) {
Assert.assertEquals(o.getCollectionTable().getSchema(), null);
return null;
}
});
代码示例来源:origin: com.manydesigns/portofino-database
private void manageIncrementGenerator(Mappings mappings, Table tab, SimpleValue id, String entityName) {
id.setIdentifierGeneratorStrategy("increment");
Properties params = new Properties();
params.put(PersistentIdentifierGenerator.IDENTIFIER_NORMALIZER,
mappings.getObjectNameNormalizer());
params.setProperty(PersistentIdentifierGenerator.SCHEMA, quoteIdentifier(tab.getSchema()));
params.put(IncrementGenerator.ENTITY_NAME,
entityName);
id.setIdentifierGeneratorProperties(params);
id.setNullValue(null);
}
代码示例来源:origin: org.hibernate/hibernate-tools
private void setSchemaSelection(Table table) {
tableSelector.clearSchemaSelections();
tableSelector.addSchemaSelection( new SchemaSelection( table
.getCatalog(), table.getSchema(), table.getName() ) );
}
代码示例来源:origin: org.hibernate/hibernate-tools
public static TableIdentifier createTableIdentifier(
Table table,
String defaultCatalog,
String defaultSchema) {
String tableName = table.getName();
String tableCatalog = getCatalogForModel(table.getCatalog(), defaultCatalog);
String tableSchema = getSchemaForModel(table.getSchema(), defaultSchema);
return new TableIdentifier(tableCatalog, tableSchema, tableName);
}
代码示例来源:origin: hibernate/hibernate-tools
public static TableIdentifier createTableIdentifier(
Table table,
String defaultCatalog,
String defaultSchema) {
String tableName = table.getName();
String tableCatalog = getCatalogForModel(table.getCatalog(), defaultCatalog);
String tableSchema = getSchemaForModel(table.getSchema(), defaultSchema);
return new TableIdentifier(tableCatalog, tableSchema, tableName);
}
代码示例来源:origin: hibernate/hibernate-tools
private void setSchemaSelection(Table table) {
tableSelector.clearSchemaSelections();
tableSelector.addSchemaSelection( new SchemaSelection( table
.getCatalog(), table.getSchema(), table.getName() ) );
}
代码示例来源:origin: org.hibernate/hibernate-tools
public Table getTable(String schema, String catalog, String name) {
for (Table table : metadataCollector.collectTableMappings()) {
if (equalOrBothNull(schema, table.getSchema()) &&
equalOrBothNull(catalog, table.getCatalog()) &&
equalOrBothNull(name, table.getName())) {
return table;
}
}
return null;
}
代码示例来源:origin: org.jbpm.jbpm3/jbpm-jpdl
private TableMetadata getTableMetadata(Connection connection, Table table)
throws SQLException {
String tableSchema = table.getSchema();
if (tableSchema == null) tableSchema = getDefaultSchema();
String tableCatalog = table.getCatalog();
if (tableCatalog == null) tableCatalog = getDefaultCatalog();
return getDatabaseMetadata(connection)
.getTableMetadata(table.getName(), tableSchema, tableCatalog, table.isQuoted());
}
内容来源于网络,如有侵权,请联系作者删除!