本文整理了Java中org.hibernate.type.Type.getName()
方法的一些代码示例,展示了Type.getName()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Type.getName()
方法的具体详情如下:
包路径:org.hibernate.type.Type
类名称:Type
方法名:getName
[英]Returns the abbreviated name of the type.
[中]返回类型的缩写名称。
代码示例来源:origin: hibernate/hibernate-orm
@Override
public String getName() {
return baseType.getName(); //TODO!
}
代码示例来源:origin: hibernate/hibernate-orm
private String getBasicTypeName(Type type) {
String typeName = type.getName();
if ( typeName == null ) {
typeName = type.getClass().getName();
}
return typeName;
}
代码示例来源:origin: hibernate/hibernate-orm
private Object throwInvalidColumnTypeException(
int i,
Type type,
Type returnType) throws HibernateException {
throw new HibernateException(
"incompatible column types: " +
type.getName() +
", " +
returnType.getName()
);
}
代码示例来源:origin: hibernate/hibernate-orm
private boolean isTimestampAsDate() {
final String typename = revisionInfoTimestampType.getName();
return "date".equals( typename ) || "time".equals( typename ) || "timestamp".equals( typename );
}
代码示例来源:origin: hibernate/hibernate-orm
private static boolean isSameType(Property left, Property right) {
return left.getType().getName().equals( right.getType().getName() );
}
代码示例来源:origin: hibernate/hibernate-orm
private String extractDetails(ScalarReturn rootReturn) {
return String.format(
"%s(name=%s, type=%s)",
rootReturn.getClass().getSimpleName(),
rootReturn.getName(),
rootReturn.getType().getName()
);
}
代码示例来源:origin: hibernate/hibernate-orm
public String getCastType(Class javaType) {
SessionFactoryImplementor factory = entityManager.getFactory();
Type hibernateType = factory.getTypeResolver().heuristicType( javaType.getName() );
if ( hibernateType == null ) {
throw new IllegalArgumentException(
"Could not convert java type [" + javaType.getName() + "] to Hibernate type"
);
}
return hibernateType.getName();
}
代码示例来源:origin: hibernate/hibernate-orm
@Override
public String toString() {
return "Attribute(name=" + getName() + ", type=" + getType().getName() + " [" + loggableMetadata() + "])";
}
}
代码示例来源:origin: hibernate/hibernate-orm
@Override
public void traceLog(TraceLogger logger) {
logger.writeLine( "Scalar[" );
logger.writeLine( " columnAlias=" + columnAlias + "," );
logger.writeLine( " type=" + ( type == null ? "<unknown>" : type.getName() ) + "," );
logger.writeLine( "]" );
}
}
代码示例来源:origin: hibernate/hibernate-orm
public void validate(Mapping mapping) throws MappingException {
super.validate(mapping);
if ( key!=null && !key.isValid(mapping) ) {
throw new MappingException(
"subclass key mapping has wrong number of columns: " +
getEntityName() +
" type: " +
key.getType().getName()
);
}
}
代码示例来源:origin: hibernate/hibernate-orm
public void validate(Mapping mapping) throws MappingException {
super.validate(mapping);
if ( key!=null && !key.isValid(mapping) ) {
throw new MappingException(
"subclass key mapping has wrong number of columns: " +
getEntityName() +
" type: " +
key.getType().getName()
);
}
}
代码示例来源:origin: hibernate/hibernate-orm
public void validate(Mapping mapping) throws MappingException {
Iterator iter = getPropertyIterator();
while ( iter.hasNext() ) {
Property prop = (Property) iter.next();
if ( !prop.isValid( mapping ) ) {
throw new MappingException(
"property mapping has wrong number of columns: " +
StringHelper.qualify( getEntityName(), prop.getName() ) +
" type: " +
prop.getType().getName()
);
}
}
checkPropertyDuplication();
checkColumnDuplication();
}
代码示例来源:origin: hibernate/hibernate-orm
private void assetTypeDefinition(
Property property,
Class expectedReturnedClass, Class expectedType) {
Type type = getMapKeyType( property );
assertEquals( expectedReturnedClass, type.getReturnedClass() );
assertEquals( expectedType.getName(), type.getName() );
}
代码示例来源:origin: hibernate/hibernate-orm
@Override
public void validate(Mapping mapping) throws MappingException {
super.validate( mapping );
if ( !getIdentifier().isValid( mapping ) ) {
throw new MappingException(
"identifier mapping has wrong number of columns: " +
getEntityName() +
" type: " +
getIdentifier().getType().getName()
);
}
checkCompositeIdentifier();
}
代码示例来源:origin: hibernate/hibernate-orm
public void validate(Mapping mapping) throws MappingException {
super.validate( mapping );
assert getElement() != null : "IndexedCollection index not bound : " + getRole();
if ( !getIndex().isValid(mapping) ) {
throw new MappingException(
"collection index mapping has wrong number of columns: " +
getRole() +
" type: " +
getIndex().getType().getName()
);
}
}
代码示例来源:origin: hibernate/hibernate-orm
public void validate(Mapping mapping) throws MappingException {
super.validate( mapping );
assert getElement() != null : "IdentifierCollection identifier not bound : " + getRole();
if ( !getIdentifier().isValid(mapping) ) {
throw new MappingException(
"collection id mapping has wrong number of columns: " +
getRole() +
" type: " +
getIdentifier().getType().getName()
);
}
}
}
代码示例来源:origin: hibernate/hibernate-orm
@SuppressWarnings({"unchecked"})
boolean addManyToOne(
Element parent,
PropertyAuditingData propertyAuditingData,
Value value,
SimpleMapperBuilder mapper) {
final Type type = value.getType();
// A null mapper occurs when adding to composite-id element
final Element manyToOneElement = parent.addElement( mapper != null ? "many-to-one" : "key-many-to-one" );
manyToOneElement.addAttribute( "name", propertyAuditingData.getName() );
manyToOneElement.addAttribute( "class", type.getName() );
// HHH-11107
// Use FK hbm magic value 'none' to skip making foreign key constraints between the Envers
// schema and the base table schema when a @ManyToOne is present in an identifier.
if ( mapper == null ) {
manyToOneElement.addAttribute( "foreign-key", "none" );
}
MetadataTools.addColumns( manyToOneElement, value.getColumnIterator() );
return true;
}
代码示例来源:origin: hibernate/hibernate-orm
@Test
public void testTypeDefinition() {
PersistentClass pc = metadata().getEntityBinding( EntitySerialize.class.getName() );
// explicitLob of SerializableToBlobType
Type explicitLobType = pc.getProperty( "explicitLob" ).getType();
assertEquals( ExplicitSerializable.class, explicitLobType.getReturnedClass() );
assertEquals( SerializableToBlobType.class.getName(), explicitLobType.getName() );
// explicit of ExplicitSerializableType
Type explicitType = pc.getProperty( "explicit" ).getType();
assertEquals( ExplicitSerializable.class, explicitType.getReturnedClass() );
assertEquals( ExplicitSerializableType.class.getName(), explicitType.getName() );
// implicit of ImplicitSerializableType
Type implicitType = pc.getProperty( "implicit" ).getType();
assertEquals( ImplicitSerializable.class, implicitType.getReturnedClass() );
assertEquals( ImplicitSerializableType.class.getName(), implicitType.getName() );
// explicitOverridingImplicit ExplicitSerializableType overrides ImplicitSerializableType
Type overrideType = pc.getProperty( "explicitOverridingImplicit" ).getType();
assertEquals( ImplicitSerializable.class, overrideType.getReturnedClass() );
assertEquals( ExplicitSerializableType.class.getName(), overrideType.getName() );
}
代码示例来源:origin: hibernate/hibernate-orm
@Test
public void metadataAssertions() {
EntityPersister p = sessionFactory().getEntityPersister( Dog.class.getName() );
assertNotNull( p );
final JoinedSubclassEntityPersister dogPersister = assertTyping( JoinedSubclassEntityPersister.class, p );
assertEquals( "string", dogPersister.getDiscriminatorType().getName() );
assertEquals( "type", dogPersister.getDiscriminatorColumnName() );
assertEquals( "dog", dogPersister.getDiscriminatorValue() );
p = sessionFactory().getEntityPersister( Cat.class.getName() );
assertNotNull( p );
final JoinedSubclassEntityPersister catPersister = assertTyping( JoinedSubclassEntityPersister.class, p );
assertEquals( "string", catPersister.getDiscriminatorType().getName() );
assertEquals( "type", catPersister.getDiscriminatorColumnName() );
assertEquals( "cat", catPersister.getDiscriminatorValue() );
}
代码示例来源:origin: hibernate/hibernate-orm
@Test
public void metadataAssertions() {
EntityPersister p = sessionFactory().getEntityPersister( Dog.class.getName() );
assertNotNull( p );
final JoinedSubclassEntityPersister dogPersister = assertTyping( JoinedSubclassEntityPersister.class, p );
assertEquals( Ejb3DiscriminatorColumn.DEFAULT_DISCRIMINATOR_TYPE, dogPersister.getDiscriminatorType().getName() );
assertEquals( Ejb3DiscriminatorColumn.DEFAULT_DISCRIMINATOR_COLUMN_NAME, dogPersister.getDiscriminatorColumnName() );
assertEquals( "Dog", dogPersister.getDiscriminatorValue() );
p = sessionFactory().getEntityPersister( Cat.class.getName() );
assertNotNull( p );
final JoinedSubclassEntityPersister catPersister = assertTyping( JoinedSubclassEntityPersister.class, p );
assertEquals( Ejb3DiscriminatorColumn.DEFAULT_DISCRIMINATOR_TYPE, catPersister.getDiscriminatorType().getName() );
assertEquals( Ejb3DiscriminatorColumn.DEFAULT_DISCRIMINATOR_COLUMN_NAME, catPersister.getDiscriminatorColumnName() );
assertEquals( "Cat", catPersister.getDiscriminatorValue() );
}
内容来源于网络,如有侵权,请联系作者删除!