Package org.hibernate.type

Examples of org.hibernate.type.Type


  private FromElement createCollectionJoin(JoinSequence collectionJoinSequence, String tableAlias) throws SemanticException {
    String text = queryableCollection.getTableName();
    AST ast = createFromElement( text );
    FromElement destination = ( FromElement ) ast;
    Type elementType = queryableCollection.getElementType();
    if ( elementType.isCollectionType() ) {
      throw new SemanticException( "Collections of collections are not supported!" );
    }
    destination.initializeCollection( fromClause, classAlias, tableAlias );
    destination.setType( JOIN_FRAGMENT );    // Tag this node as a JOIN.
    destination.setIncludeSubclasses( false )// Don't include subclasses in the join.
View Full Code Here


      Element returnElem = (Element) returns.next();
      String name = returnElem.getName();
      if ( "return-scalar".equals( name ) ) {
        String column = returnElem.attributeValue( "column" );
        String typeFromXML = HbmBinder.getTypeFromXML( returnElem );
        Type type = null;
        if(typeFromXML!=null) {
          type = TypeFactory.heuristicType( typeFromXML );
          if ( type == null ) {
            throw new MappingException( "could not determine type " + type );
          }
View Full Code Here

        entityAccessStrategies.put( cacheRegionName, accessStrategy );
        allCacheRegions.put( cacheRegionName, collectionRegion );
      }
      CollectionPersister persister = PersisterFactory.createCollectionPersister( cfg, model, accessStrategy, this) ;
      collectionPersisters.put( model.getRole(), persister.getCollectionMetadata() );
      Type indexType = persister.getIndexType();
      if ( indexType != null && indexType.isAssociationType() && !indexType.isAnyType() ) {
        String entityName = ( ( AssociationType ) indexType ).getAssociatedEntityName( this );
        Set roles = ( Set ) tmpEntityToCollectionRoleMap.get( entityName );
        if ( roles == null ) {
          roles = new HashSet();
          tmpEntityToCollectionRoleMap.put( entityName, roles );
        }
        roles.add( persister.getRole() );
      }
      Type elementType = persister.getElementType();
      if ( elementType.isAssociationType() && !elementType.isAnyType() ) {
        String entityName = ( ( AssociationType ) elementType ).getAssociatedEntityName( this );
        Set roles = ( Set ) tmpEntityToCollectionRoleMap.get( entityName );
        if ( roles == null ) {
          roles = new HashSet();
          tmpEntityToCollectionRoleMap.put( entityName, roles );
View Full Code Here

  public boolean hasSequentialSelect() {
    return hasSequentialSelects;
  }
 
  private int getSubclassPropertyTableNumber(String propertyName, String entityName) {
    Type type = propertyMapping.toType(propertyName);
    if ( type.isAssociationType() && ( (AssociationType) type ).useLHSPrimaryKey() ) return 0;
    final Integer tabnum = (Integer) propertyTableNumbersByNameAndSubclass.get(entityName + '.' + propertyName);
    return tabnum==null ? 0 : tabnum.intValue();
  }
View Full Code Here

  }

  protected abstract String getEntityName();

  public Type toType(String propertyName) throws QueryException {
    Type type = (Type) typesByPropertyPath.get(propertyName);
    if ( type == null ) {
      throw propertyException( propertyName );
    }
    return type;
  }
View Full Code Here

      final String path,
      final EntityType etype,
      final String[] columns,
      final Mapping factory) throws MappingException {

    Type idtype = etype.getIdentifierOrUniqueKeyType( factory );
    String idPropName = etype.getIdentifierOrUniqueKeyPropertyName(factory);
    boolean hasNonIdentifierPropertyNamedId = hasNonIdentifierPropertyNamedId( etype, factory );

    if ( etype.isReferenceToPrimaryKey() ) {
      if ( !hasNonIdentifierPropertyNamedId ) {
View Full Code Here

  public boolean isPrimitive(Class clazz) {
    return getGetter(clazz).getReturnType().isPrimitive();
  }

  public CascadeStyle getCascadeStyle() throws MappingException {
    Type type = value.getType();
    if ( type.isComponentType() && !type.isAnyType() ) {
      AbstractComponentType actype = (AbstractComponentType) type;
      int length = actype.getSubtypes().length;
      for ( int i=0; i<length; i++ ) {
        if ( actype.getCascadeStyle(i)!=CascadeStyle.NONE ) return CascadeStyle.ALL;
      }
View Full Code Here

   */
  public void initialize() {
    // TODO : this really needs to be delayed unitl after we definitively know the operand node type;
    // where this is currently a problem is parameters for which where we cannot unequivocally
    // resolve an expected type
    Type operandType = extractDataType( getOperand() );
    if ( operandType == null ) {
      return;
    }
    SessionFactoryImplementor sessionFactory = getSessionFactoryHelper().getFactory();
    int operandColumnSpan = operandType.getColumnSpan( sessionFactory );
    if ( operandColumnSpan > 1 ) {
      mutateRowValueConstructorSyntax( operandColumnSpan );
    }
  }
View Full Code Here

      }
    }
  }

  private static Type extractDataType(Node operand) {
    Type type = null;
    if ( operand instanceof SqlNode ) {
      type = ( ( SqlNode ) operand ).getDataType();
    }
    if ( type == null && operand instanceof ExpectedTypeAwareNode ) {
      type = ( ( ExpectedTypeAwareNode ) operand ).getExpectedType();
View Full Code Here

   * SingleTableEntityPersister defines an overloaded form
   * which takes the entity name.
   */
  public int getSubclassPropertyTableNumber(String propertyPath) {
    String rootPropertyName = StringHelper.root(propertyPath);
    Type type = propertyMapping.toType(rootPropertyName);
    if ( type.isAssociationType() ) {
      AssociationType assocType = ( AssociationType ) type;
      if ( assocType.useLHSPrimaryKey() ) {
        // performance op to avoid the array search
        return 0;
      }
      else if ( type.isCollectionType() ) {
        // properly handle property-ref-based associations
        rootPropertyName = assocType.getLHSPropertyName();
      }
    }
    //Enable for HHH-440, which we don't like:
View Full Code Here

TOP

Related Classes of org.hibernate.type.Type

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.