@Override public String getName() { return baseType.getName(); //TODO! }
private String getBasicTypeName(Type type) { String typeName = type.getName(); if ( typeName == null ) { typeName = type.getClass().getName(); } return typeName; }
private boolean isTimestampAsDate() { final String typename = revisionInfoTimestampType.getName(); return "date".equals( typename ) || "time".equals( typename ) || "timestamp".equals( typename ); }
private String extractDetails(ScalarReturn rootReturn) { return String.format( "%s(name=%s, type=%s)", rootReturn.getClass().getSimpleName(), rootReturn.getName(), rootReturn.getType().getName() ); }
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(); }
@Override public String toString() { return "Attribute(name=" + getName() + ", type=" + getType().getName() + " [" + loggableMetadata() + "])"; } }
@Override public void traceLog(TraceLogger logger) { logger.writeLine( "Scalar[" ); logger.writeLine( " columnAlias=" + columnAlias + "," ); logger.writeLine( " type=" + ( type == null ? "<unknown>" : type.getName() ) + "," ); logger.writeLine( "]" ); } }
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() ); } }
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() ); } }
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(); }
private void assetTypeDefinition( Property property, Class expectedReturnedClass, Class expectedType) { Type type = getMapKeyType( property ); assertEquals( expectedReturnedClass, type.getReturnedClass() ); assertEquals( expectedType.getName(), type.getName() ); }
@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(); }
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() ); } }
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() ); } } }
@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; }
@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() ); }
@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() ); }
@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() ); }