Package org.hibernate.ogm.type

Examples of org.hibernate.ogm.type.TypeTranslator


  private volatile MapDatastoreProvider provider;

  public MapPessimisticWriteLockingStrategy(Lockable lockable, LockMode lockMode) {
    this.lockable = lockable;
    this.lockMode = lockMode;
    TypeTranslator typeTranslator = lockable.getFactory().getServiceRegistry().getService( TypeTranslator.class );
    this.identifierGridType = typeTranslator.getType( lockable.getIdentifierType() );
  }
View Full Code Here


    }

    initPropertyPaths( mapping );

    //Grid related metadata
    TypeTranslator typeTranslator = serviceRegistry.getService( TypeTranslator.class );
    final Type[] types = getPropertyTypes();
    final int length = types.length;
    gridPropertyTypes = new GridType[length];
    for (int index = 0 ; index < length ; index++) {
      gridPropertyTypes[index] = typeTranslator.getType( types[index] );
    }
    gridVersionType = typeTranslator.getType( getVersionType() );
    gridIdentifierType = typeTranslator.getType( getIdentifierType() );
    List<String> columnNames = new ArrayList<String>();
    for ( int propertyCount = 0; propertyCount < this.getPropertySpan(); propertyCount++ ) {
      String[] property = this.getPropertyColumnNames( propertyCount );
      for ( int columnCount = 0; columnCount < property.length; columnCount++ ) {
        columnNames.add( property[columnCount] );
View Full Code Here

  public OgmCollectionPersister(final Collection collection, final CollectionRegionAccessStrategy cacheAccessStrategy, final Configuration cfg, final SessionFactoryImplementor factory)
      throws MappingException, CacheException {
    super( collection, cacheAccessStrategy, cfg, factory );
    ServiceRegistry registry = factory.getServiceRegistry();
    final TypeTranslator typeTranslator = registry.getService( TypeTranslator.class );
    this.gridDialect = registry.getService( GridDialect.class );

    keyGridType = typeTranslator.getType( getKeyType() );
    elementGridType = typeTranslator.getType( getElementType() );
    indexGridType = typeTranslator.getType( getIndexType() );
    identifierGridType = typeTranslator.getType( getIdentifierType() );
    // copied from the superclass constructor
    isInverse = collection.isInverse();
    oneToMany = collection.isOneToMany();
    if ( collection.isOneToMany() && getElementPersister() != null && getElementType().isEntityType() ) {
      associationType = AssociationType.EMBEDDED_FK_TO_ENTITY;
      final Type identifierOrUniqueKeyType = ( (EntityType) getElementType() )
          .getIdentifierOrUniqueKeyType( factory );
      gridTypeOfAssociatedId = typeTranslator.getType( identifierOrUniqueKeyType );
    }
    else if ( collection.isOneToMany() ) {
      // one to many but not what we expected
      throw new AssertionFailure( "Association marked as one to many but has no ManyToOneType: " + collection.getRole() );
    }
    else if ( getElementType().isAssociationType() && getElementType().isEntityType() ) {
      associationType = AssociationType.ASSOCIATION_TABLE_TO_ENTITY;
      final Type identifierOrUniqueKeyType = ( (EntityType) getElementType() ).getIdentifierOrUniqueKeyType( factory );
      gridTypeOfAssociatedId = typeTranslator.getType( identifierOrUniqueKeyType );
    }
    else {
      gridTypeOfAssociatedId = null;
      associationType = AssociationType.OTHER;
    }
View Full Code Here

   * corresponding to each parameter type.
   */
  private Map<String, Object> getNamedParameterValuesConvertedByGridType(QueryParameters queryParameters) {
    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

   * corresponding to each parameter type.
   */
  private Map<String, Object> getNamedParameterValuesConvertedByGridType(QueryParameters queryParameters) {
    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

  private final Lockable lockable;

  public InfinispanPessimisticWriteLockingStrategy(Lockable lockable, LockMode lockMode) {
    this.lockMode = lockMode;
    this.lockable = lockable;
    TypeTranslator typeTranslator = lockable.getFactory().getServiceRegistry().getService( TypeTranslator.class );
    this.identifierGridType = typeTranslator.getType( lockable.getIdentifierType() );
  }
View Full Code Here

  protected final GridType identifierGridType;

  public InfinispanPessimisticWriteLockingStrategy(Lockable lockable, LockMode lockMode) {
    this.lockMode = lockMode;
    this.lockable = lockable;
    TypeTranslator typeTranslator = lockable.getFactory().getServiceRegistry().getService( TypeTranslator.class );
    this.identifierGridType = typeTranslator.getType(lockable.getIdentifierType());
  }
View Full Code Here

    }

    initPropertyPaths( mapping );

    //Grid related metadata
    TypeTranslator typeTranslator = serviceRegistry.getService( TypeTranslator.class );
    final Type[] types = getPropertyTypes();
    final int length = types.length;
    gridPropertyTypes = new GridType[length];
    for (int index = 0 ; index < length ; index++) {
      gridPropertyTypes[index] = typeTranslator.getType( types[index] );
    }
    gridVersionType = typeTranslator.getType( getVersionType() );
    gridIdentifierType = typeTranslator.getType( getIdentifierType() );
    List<String> columnNames = new ArrayList<String>();
    for ( int propertyCount = 0; propertyCount < this.getPropertySpan(); propertyCount++ ) {
      String[] property = this.getPropertyColumnNames( propertyCount );
      for ( int columnCount = 0; columnCount < property.length; columnCount++ ) {
        columnNames.add( property[columnCount] );
View Full Code Here

  public OgmCollectionPersister(final Collection collection, final CollectionRegionAccessStrategy cacheAccessStrategy, final Configuration cfg, final SessionFactoryImplementor factory)
      throws MappingException, CacheException {
    super( collection, cacheAccessStrategy, cfg, factory );
    ServiceRegistry registry = factory.getServiceRegistry();
    final TypeTranslator typeTranslator = registry.getService( TypeTranslator.class );
    this.gridDialect = registry.getService( GridDialect.class );

    keyGridType = typeTranslator.getType( getKeyType() );
    elementGridType = typeTranslator.getType( getElementType() );
    indexGridType = typeTranslator.getType( getIndexType() );
    identifierGridType = typeTranslator.getType( getIdentifierType() );
    // copied from the superclass constructor
    isInverse = collection.isInverse();
    oneToMany = collection.isOneToMany();
    if ( collection.isOneToMany() && getElementPersister() != null && getElementType().isEntityType() ) {
      associationType = AssociationType.EMBEDDED_FK_TO_ENTITY;
      final Type identifierOrUniqueKeyType = ( (EntityType) getElementType() )
          .getIdentifierOrUniqueKeyType( factory );
      gridTypeOfAssociatedId = typeTranslator.getType( identifierOrUniqueKeyType );
    }
    else if ( collection.isOneToMany() ) {
      // one to many but not what we expected
      throw new AssertionFailure( "Association marked as one to many but has no ManyToOneType: " + collection.getRole() );
    }
    else if ( getElementType().isAssociationType() && getElementType().isEntityType() ) {
      associationType = AssociationType.ASSOCIATION_TABLE_TO_ENTITY;
      final Type identifierOrUniqueKeyType = ( (EntityType) getElementType() ).getIdentifierOrUniqueKeyType( factory );
      gridTypeOfAssociatedId = typeTranslator.getType( identifierOrUniqueKeyType );
    }
    else {
      gridTypeOfAssociatedId = null;
      associationType = AssociationType.OTHER;
    }
View Full Code Here

    }

    initPropertyPaths(mapping);

    //Grid related metadata
    TypeTranslator typeTranslator = serviceRegistry.getService(TypeTranslator.class);
    final Type[] types = getPropertyTypes();
    final int length = types.length;
    gridPropertyTypes = new GridType[length];
    for (int index = 0 ; index < length ; index++) {
      gridPropertyTypes[index] = typeTranslator.getType( types[index] );
    }
    gridVersionType = typeTranslator.getType( getVersionType() );
    gridIdentifierType = typeTranslator.getType( getIdentifierType() );
    List<String> columnNames = new ArrayList<String>();
    for ( int propertyCount = 0; propertyCount < this.getPropertySpan(); propertyCount++ ) {
      String[] property = this.getPropertyColumnNames( propertyCount );
      for ( int columnCount = 0; columnCount < property.length; columnCount++ ) {
        columnNames.add( property[columnCount] );
View Full Code Here

TOP

Related Classes of org.hibernate.ogm.type.TypeTranslator

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.