本文整理了Java中org.hibernate.mapping.Table.getName()
方法的一些代码示例,展示了Table.getName()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Table.getName()
方法的具体详情如下:
包路径:org.hibernate.mapping.Table
类名称:Table
方法名:getName
暂无
代码示例来源:origin: hibernate/hibernate-orm
@Override
public String getLogicalTableName(Table ownerTable) {
final Identifier logicalName = physicalToLogicalTableNameMap.get( ownerTable.getNameIdentifier() );
if ( logicalName == null ) {
throw new MappingException( "Unable to find physical table: " + ownerTable.getName() );
}
return logicalName.render();
}
代码示例来源: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
@Override
public boolean includeTable(Table table) {
// exclude table "the_entity_2"
return !"the_entity_2".equals( table.getName() );
}
代码示例来源:origin: hibernate/hibernate-orm
@Override
public boolean includeTable(Table table) {
// exclude table "the_entity_2"
return !"the_entity_2".equals( table.getName() );
}
代码示例来源:origin: hibernate/hibernate-orm
public String toString() {
if ( !isReferenceToPrimaryKey() ) {
return getClass().getName()
+ '(' + getTable().getName() + getColumns()
+ " ref-columns:" + '(' + getReferencedColumns() + ") as " + getName() + ")";
}
else {
return super.toString();
}
}
代码示例来源:origin: hibernate/hibernate-orm
public void createPrimaryKey() {
//Primary key constraint
PrimaryKey pk = new PrimaryKey( table );
pk.setName( PK_ALIAS.toAliasString( table.getName() ) );
table.setPrimaryKey(pk);
pk.addColumns( getKey().getColumnIterator() );
}
代码示例来源:origin: hibernate/hibernate-orm
@Test
public void testTableName() {
assert MIDDLE_VERSIONS_ENTITY_NAME.equals(
metadata().getEntityBinding( MIDDLE_VERSIONS_ENTITY_NAME ).getTable().getName()
);
}
代码示例来源:origin: hibernate/hibernate-orm
@Test
public void testTableName() {
assert "naming_test_entity_1_versions".equals(
metadata().getEntityBinding( "org.hibernate.envers.test.integration.naming.NamingTestEntity1_AUD" ).getTable().getName()
);
}
}
代码示例来源:origin: hibernate/hibernate-orm
protected void checkDefaultCollectionTableName(
Class<?> ownerEntityClass,
String ownerCollectionPropertyName,
String expectedCollectionTableName) {
final org.hibernate.mapping.Collection collection = metadata().getCollectionBinding(
ownerEntityClass.getName() + '.' + ownerCollectionPropertyName
);
final org.hibernate.mapping.Table table = collection.getCollectionTable();
assertEquals( expectedCollectionTableName, table.getName() );
}
代码示例来源:origin: hibernate/hibernate-orm
@SuppressWarnings({"unchecked"})
@Test
public void testTableNames() {
assert "sec_embid_versions".equals(
((Iterator<Join>)
metadata().getEntityBinding(
"org.hibernate.envers.test.integration.secondary.ids.SecondaryEmbIdTestEntity_AUD"
).getJoinIterator()).next().getTable().getName()
);
}
}
代码示例来源:origin: hibernate/hibernate-orm
@Test
public void testTableName() {
assert MIDDLE_VERSIONS_ENTITY_NAME.equals(
metadata().getEntityBinding( MIDDLE_VERSIONS_ENTITY_NAME ).getTable().getName()
);
}
代码示例来源:origin: hibernate/hibernate-orm
@Test
public void testExpectedTableNameComponent1() {
PersistentClass auditClass = metadata().getEntityBinding(
COMPONENT_1_AUDIT_JOIN_TABLE_NAME
);
assert auditClass != null;
assert COMPONENT_1_AUDIT_JOIN_TABLE_NAME.equals(
auditClass.getTable()
.getName()
);
}
代码示例来源:origin: hibernate/hibernate-orm
@Test
public void testExpectedTableNameComponent2() {
PersistentClass auditClass = metadata().getEntityBinding(
COMPONENT_2_AUDIT_JOIN_TABLE_NAME
);
assert auditClass != null;
assert COMPONENT_2_AUDIT_JOIN_TABLE_NAME.equals(
auditClass.getTable()
.getName()
);
}
代码示例来源:origin: hibernate/hibernate-orm
@Test
@TestForIssue(jiraKey = "HHH-9327")
public void testManyToManyCollectionTable() {
final Collection collectionMapping = metadata.getCollectionBinding(
Category.class.getName() + "." + "items"
);
final String expectedTableName = transformEntityName( Category.class.getName() ) + "_" + transformEntityName( Item.class.getName() );
assertEquals( expectedTableName, collectionMapping.getCollectionTable().getName() );
}
代码示例来源:origin: hibernate/hibernate-orm
@Test
public void testAbstractTableExistence() {
for ( Table table : metadata().collectTableMappings() ) {
if ( "AbstractEntity_AUD".equals( table.getName() ) ) {
Assert.assertFalse( table.isPhysicalTable() );
return;
}
}
Assert.fail();
}
}
代码示例来源: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
@TestForIssue(jiraKey = "HHH-5848")
public void testDatabaseTableNames() {
PersistentClass classMapping = metadata().getEntityBinding( Item.class.getName() );
Column secTabColumn = (Column) classMapping.getProperty( "specialPrice" ).getColumnIterator().next();
assertEquals( "TAB_ITEMS_SEC", secTabColumn.getValue().getTable().getName() );
Column tabColumn = (Column) classMapping.getProperty( "price" ).getColumnIterator().next();
assertEquals( "TAB_ITEMS", tabColumn.getValue().getTable().getName() );
}
}
代码示例来源:origin: hibernate/hibernate-orm
@Test
@TestForIssue(jiraKey = "HHH-12975")
public void testMapsIdJoinColumnForeignKeyNoConstraint() {
for ( Namespace namespace : metadata().getDatabase().getNamespaces() ) {
for ( Table table : namespace.getTables() ) {
if ( "Post".equals( table.getName() ) ) {
assertEquals( 0, table.getForeignKeys().size() );
}
}
}
}
代码示例来源:origin: hibernate/hibernate-orm
@Test
@TestForIssue(jiraKey = "HHH-12975")
public void testPrimaryKeyJoinColumnForeignKeyNoConstraint() {
for ( Namespace namespace : metadata().getDatabase().getNamespaces() ) {
for ( Table table : namespace.getTables() ) {
if ( "Car".equals( table.getName() ) ) {
assertEquals( 0, table.getForeignKeys().size() );
}
}
}
}
代码示例来源:origin: hibernate/hibernate-orm
@Test
public void testRevEntityTableCreation() {
for ( Table table : metadata().collectTableMappings() ) {
if ( "REVCHANGES".equals( table.getName() ) ) {
assert table.getColumnSpan() == 2;
assert table.getColumn( new Column( "REV" ) ) != null;
assert table.getColumn( new Column( "ENTITYNAME" ) ) != null;
return;
}
}
assert false;
}
内容来源于网络,如有侵权,请联系作者删除!