Package org.hibernate.ogm.type.spi

Examples of org.hibernate.ogm.type.spi.GridType


    return gridValue;
  }

  private Object convertToGridType(Object value, Type propertyType) {
    Tuple dummy = new Tuple();
    GridType gridType = typeTranslator().getType( propertyType );
    gridType.nullSafeSet( dummy, value, new String[] { "key" }, null );
    return dummy.get( "key" );
  }
View Full Code Here


    Map<String, Object> parameterValues = new HashMap<String, Object>( queryParameters.getNamedParameters().size() );
    Tuple dummy = new Tuple();
    TypeTranslator typeTranslator = serviceRegistry.getService( TypeTranslator.class );

    for ( Entry<String, TypedValue> parameter : queryParameters.getNamedParameters().entrySet() ) {
      GridType gridType = typeTranslator.getType( parameter.getValue().getType() );
      gridType.nullSafeSet( dummy, parameter.getValue().getValue(), new String[]{ parameter.getKey() }, null );
      parameterValues.put( parameter.getKey(), dummy.get( parameter.getKey() ) );
    }

    return parameterValues;
  }
View Full Code Here

    }
    else {
      if (optionalId == null) {
        final OgmEntityPersister currentPersister = entityPersisters[0];
        Tuple tuple =  ogmLoadingContext.getResultSet().getTuple();
        GridType gridIdentifierType = currentPersister.getGridIdentifierType();
        optionalId = (Serializable) gridIdentifierType.nullSafeGet( tuple, currentPersister.getIdentifierColumnNames(), session, null );
      }
      final org.hibernate.engine.spi.EntityKey key = session.generateEntityKey( optionalId,  entityPersisters[0] );
      keys[0] = key;
    }
  }
View Full Code Here

      return null;
    }

    //TODO should we cache results? It seems an actual HashMap might be slower but it makes it more robust
    //     against badly written dialects
    GridType dialectType = dialect.overrideType( type );
    if ( dialectType != null ) {
      return dialectType;
    }
    else if ( type instanceof AbstractStandardBasicType ) {
      AbstractStandardBasicType<?> exposedType = (AbstractStandardBasicType<?>) type;
      final GridType gridType = typeConverter.get( exposedType.getJavaTypeDescriptor() );
      if (gridType == null) {
        throw log.unableToFindGridType( exposedType.getJavaTypeDescriptor().getJavaTypeClass().getName() );
      }
      return gridType;
    }
View Full Code Here

  /**
   * Returns the object referenced by the specified property (which represents an association).
   */
  private Object getReferencedEntity(int propertyIndex) {
    GridType propertyType = persister.getGridPropertyTypes()[propertyIndex];

    Serializable id = (Serializable) propertyType.hydrate(
        resultset, persister.getPropertyColumnNames( propertyIndex ), session, null
    );

    if ( id != null ) {
      EntityPersister hostingEntityPersister = session.getFactory().getEntityPersister(
          propertyType.getReturnedClass().getName()
      );

      return session.getPersistenceContext().getEntity(
          session.generateEntityKey( id, hostingEntityPersister )
      );
View Full Code Here

      Tuple tuple = tuples.next();
      Object[] entry = new Object[queryReturnTypes.length];

      int i = 0;
      for ( Type type : queryReturnTypes ) {
        GridType gridType = typeTranslator.getType( type );
        entry[i] = gridType.nullSafeGet( tuple, scalarColumns.get( i ), session, null );
        i++;
      }

      if ( entry.length == 1 ) {
        results.add( entry[0] );
View Full Code Here

        for ( Return queryReturn : customQuery.getCustomQueryReturns() ) {
          ScalarReturn scalarReturn = (ScalarReturn) queryReturn;
          Type type = scalarReturn.getType();

          if ( type != null ) {
            GridType gridType = typeTranslator.getType( type );
            entry[i++] = gridType.nullSafeGet( tuple, scalarReturn.getColumnAlias(), session, null );
          }
          else {
            entry[i++] = tuple.get( scalarReturn.getColumnAlias() );
          }
        }
View Full Code Here

  }

  @Override
  public void nullSafeSet(Tuple resultset, Object value, String[] names, boolean[] settable, SessionImplementor session)
      throws HibernateException {
    GridType idGridType = getIdGridType( session );
    idGridType.nullSafeSet( resultset, getIdentifier( value, session ), names, settable, session );
  }
View Full Code Here

    idGridType.nullSafeSet( resultset, getIdentifier( value, session ), names, settable, session );
  }

  private GridType getIdGridType(SessionImplementor session) {
    final Type idType = delegate.getIdentifierOrUniqueKeyType( session.getFactory() );
    GridType idGridType = typeTranslator.getType( idType );
    return idGridType;
  }
View Full Code Here

  }

  @Override
  public void nullSafeSet(Tuple resultset, Object value, String[] names, SessionImplementor session)
      throws HibernateException {
    GridType idGridType = getIdGridType( session );
    idGridType.nullSafeSet( resultset, getIdentifier( value, session ), names, session );
  }
View Full Code Here

TOP

Related Classes of org.hibernate.ogm.type.spi.GridType

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.