本文整理了Java中org.hibernate.mapping.Column.setName()
方法的一些代码示例,展示了Column.setName()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Column.setName()
方法的具体详情如下:
包路径:org.hibernate.mapping.Column
类名称:Column
方法名:setName
暂无
代码示例来源:origin: hibernate/hibernate-orm
public Column(String columnName) {
setName( columnName );
}
代码示例来源:origin: hibernate/hibernate-orm
public void addDefaultJoinColumnName(PersistentClass referencedEntity, String logicalReferencedColumn) {
final String columnName = buildDefaultColumnName( referencedEntity, logicalReferencedColumn );
getMappingColumn().setName( columnName );
setLogicalColumnName( columnName );
}
代码示例来源:origin: hibernate/hibernate-orm
@Override
public void redefineColumnName(String columnName, String propertyName, boolean applyNamingStrategy) {
if ( StringHelper.isNotEmpty( columnName ) ) {
if ( applyNamingStrategy ) {
getMappingColumn().setName(
getBuildingContext().getBuildingOptions().getPhysicalNamingStrategy().toPhysicalColumnName(
getBuildingContext().getMetadataCollector().getDatabase().toIdentifier( columnName ),
getBuildingContext().getMetadataCollector().getDatabase().getJdbcEnvironment()
).render()
);
}
else {
getMappingColumn().setName( columnName );
}
}
}
代码示例来源:origin: hibernate/hibernate-orm
@Test
public void testDefaultValue() throws Exception {
Join join = (Join) metadata().getEntityBinding( Life.class.getName() ).getJoinClosureIterator().next();
assertEquals( "ExtendedLife", join.getTable().getName() );
org.hibernate.mapping.Column owner = new org.hibernate.mapping.Column();
owner.setName( "LIFE_ID" );
assertTrue( join.getTable().getPrimaryKey().containsColumn( owner ) );
Session s = openSession();
Transaction tx = s.beginTransaction();
Life life = new Life();
life.duration = 15;
life.fullDescription = "Long long description";
s.persist( life );
tx.commit();
s.close();
s = openSession();
tx = s.beginTransaction();
Query q = s.createQuery( "from " + Life.class.getName() );
life = (Life) q.uniqueResult();
assertEquals( "Long long description", life.fullDescription );
tx.commit();
s.close();
}
代码示例来源:origin: hibernate/hibernate-orm
mappingColumn.setName( physicalName.render( database.getDialect() ) );
final Identifier explicitName = database.toIdentifier( columnName );
final Identifier physicalName = physicalNamingStrategy.toPhysicalColumnName( explicitName, database.getJdbcEnvironment() );
mappingColumn.setName( physicalName.render( database.getDialect() ) );
mappingColumn.setName( normalizer.toDatabaseIdentifierText( columnName ) );
代码示例来源:origin: hibernate/hibernate-orm
@Test
public void testCompositePK() throws Exception {
Join join = (Join) metadata().getEntityBinding( Dog.class.getName() ).getJoinClosureIterator().next();
assertEquals( "DogThoroughbred", join.getTable().getName() );
org.hibernate.mapping.Column owner = new org.hibernate.mapping.Column();
owner.setName( "OWNER_NAME" );
assertTrue( join.getTable().getPrimaryKey().containsColumn( owner ) );
Session s = openSession();
Transaction tx = s.beginTransaction();
Dog dog = new Dog();
DogPk id = new DogPk();
id.name = "Thalie";
id.ownerName = "Martine";
dog.id = id;
dog.weight = 30;
dog.thoroughbredName = "Colley";
s.persist( dog );
tx.commit();
s.close();
s = openSession();
tx = s.beginTransaction();
Query q = s.createQuery( "from Dog" );
dog = (Dog) q.uniqueResult();
assertEquals( "Colley", dog.thoroughbredName );
tx.commit();
s.close();
}
代码示例来源:origin: hibernate/hibernate-orm
/**
* Shallow copy, the value is not copied
*/
@Override
public Column clone() {
Column copy = new Column();
copy.setLength( length );
copy.setScale( scale );
copy.setValue( value );
copy.setTypeIndex( typeIndex );
copy.setName( getQuotedName() );
copy.setNullable( nullable );
copy.setPrecision( precision );
copy.setUnique( unique );
copy.setSqlType( sqlType );
copy.setSqlTypeCode( sqlTypeCode );
copy.uniqueInteger = uniqueInteger; //usually useless
copy.setCheckConstraint( checkConstraint );
copy.setComment( comment );
copy.setDefaultValue( defaultValue );
copy.setCustomRead( customRead );
copy.setCustomWrite( customWrite );
return copy;
}
代码示例来源:origin: hibernate/hibernate-orm
copy.setScale( column.getScale() );
copy.setValue( key );
copy.setName( column.getQuotedName() );
copy.setNullable( column.isNullable() );
copy.setPrecision( column.getPrecision() );
代码示例来源:origin: org.hibernate/hibernate-annotations
public void addDefaultJoinColumnName(PersistentClass referencedEntity, String logicalReferencedColumn) {
final String columnName = buildDefaultColumnName( referencedEntity, logicalReferencedColumn );
getMappingColumn().setName( columnName );
setLogicalColumnName( columnName );
}
代码示例来源:origin: hibernate/hibernate-orm
copy.setScale( column.getScale() );
copy.setValue( manyToOne );
copy.setName( column.getQuotedName() );
copy.setNullable( column.isNullable() );
copy.setPrecision( column.getPrecision() );
代码示例来源:origin: org.hibernate/hibernate-annotations
@Override
public void redefineColumnName(String columnName, String propertyName, boolean applyNamingStrategy) {
if ( StringHelper.isNotEmpty( columnName ) ) {
getMappingColumn().setName(
applyNamingStrategy ?
getMappings().getNamingStrategy().columnName( columnName ) :
columnName
);
}
}
代码示例来源:origin: org.hibernate/hibernate-annotations
public void redefineColumnName(String columnName, String propertyName, boolean applyNamingStrategy) {
if ( applyNamingStrategy ) {
if ( StringHelper.isEmpty( columnName ) ) {
if ( propertyName != null ) {
mappingColumn.setName(
mappings.getObjectNameNormalizer().normalizeIdentifierQuoting(
mappings.getNamingStrategy().propertyToColumnName( propertyName )
)
);
}
//Do nothing otherwise
}
else {
columnName = mappings.getObjectNameNormalizer().normalizeIdentifierQuoting( columnName );
columnName = mappings.getNamingStrategy().columnName( columnName );
columnName = mappings.getObjectNameNormalizer().normalizeIdentifierQuoting( columnName );
mappingColumn.setName( columnName );
}
}
else {
if ( StringHelper.isNotEmpty( columnName ) ) {
mappingColumn.setName( mappings.getObjectNameNormalizer().normalizeIdentifierQuoting( columnName ) );
}
}
}
代码示例来源:origin: hibernate/hibernate-orm
database.getJdbcEnvironment()
);
column.setName( physicalName.render( database.getDialect() ) );
代码示例来源:origin: org.hibernate/hibernate-annotations
copy.setScale( column.getScale() );
copy.setValue( key );
copy.setName( column.getQuotedName() );
copy.setNullable( column.isNullable() );
copy.setPrecision( column.getPrecision() );
代码示例来源:origin: hibernate/hibernate-tools
private static Column getColumn(MetaDataDialect metaDataDialect, Table table, String columnName) {
Column column = new Column();
column.setName(quote(metaDataDialect, columnName));
Column existing = table.getColumn(column);
if(existing!=null) {
column = existing;
}
return column;
}
代码示例来源:origin: org.hibernate.orm/hibernate-core
public void addDefaultJoinColumnName(PersistentClass referencedEntity, String logicalReferencedColumn) {
final Identifier columnName = buildDefaultColumnName( referencedEntity, logicalReferencedColumn );
getMappingColumn().setName( columnName );
setLogicalColumnName( columnName );
}
代码示例来源:origin: org.hibernate/hibernate-tools
private static Column getColumn(MetaDataDialect metaDataDialect, Table table, String columnName) {
Column column = new Column();
column.setName(quote(columnName, metaDataDialect));
Column existing = table.getColumn(column);
if(existing!=null) {
column = existing;
}
return column;
}
代码示例来源:origin: org.hibernate/hibernate-annotations
copy.setScale( column.getScale() );
copy.setValue( manyToOne );
copy.setName( column.getQuotedName() );
copy.setNullable( column.isNullable() );
copy.setPrecision( column.getPrecision() );
代码示例来源:origin: org.hibernate/com.springsource.org.hibernate.core
@Override
public void redefineColumnName(String columnName, String propertyName, boolean applyNamingStrategy) {
if ( StringHelper.isNotEmpty( columnName ) ) {
getMappingColumn().setName(
applyNamingStrategy ?
getMappings().getNamingStrategy().columnName( columnName ) :
columnName
);
}
}
代码示例来源:origin: jboss.jboss-embeddable-ejb3/hibernate-all
@Override
public void redefineColumnName(String columnName, String propertyName, boolean applyNamingStrategy) {
if ( StringHelper.isNotEmpty( columnName ) ) {
getMappingColumn().setName(
applyNamingStrategy ?
getMappings().getNamingStrategy().columnName( columnName ) :
columnName
);
}
}
内容来源于网络,如有侵权,请联系作者删除!