Package org.hibernate.ogm.options.spi.OptionsService

Examples of org.hibernate.ogm.options.spi.OptionsService.OptionsServiceContext


    Contracts.assertNotNull( associationTypeContext, "Association type context has not yet been initialized" );
    return associationTypeContext;
  }

  public AssociationTypeContext getAssociationTypeContext(String mainSidePropertyName) {
    OptionsServiceContext serviceContext = getFactory()
        .getServiceRegistry()
        .getService( OptionsService.class )
        .context();

    AssociationTypeContext associationTypeContext = new AssociationTypeContextImpl(
        serviceContext.getPropertyOptions( getOwnerEntityPersister().getMappedClass(), associationKeyMetadata.getCollectionRole() ),
        associationKeyMetadata.getAssociatedEntityKeyMetadata(),
        mainSidePropertyName
    );

    return associationTypeContext;
View Full Code Here


      associationPersister.flushToDatastore();
    }
  }

  private AssociationPersister createAssociationPersister(int propertyIndex, AssociationKeyMetadata associationKeyMetadata, Object[] keyColumnValues) {
    OptionsServiceContext serviceContext = session.getFactory()
        .getServiceRegistry()
        .getService( OptionsService.class )
        .context();

    AssociationTypeContext associationTypeContext = new AssociationTypeContextImpl(
        serviceContext.getPropertyOptions( persister.getPropertyTypes()[propertyIndex].getReturnedClass(), associationKeyMetadata.getCollectionRole() ),
        associationKeyMetadata.getAssociatedEntityKeyMetadata(),
        persister.getPropertyNames()[propertyIndex]
    );

    return new AssociationPersister(
View Full Code Here

      throw new AssertionFailure( "loadByUniqueKey on a non EntityType:" + propertyName );
    }

    OgmEntityPersister inversePersister = (OgmEntityPersister) ((EntityType) getPropertyTypes()[propertyIndex]).getAssociatedJoinable( session.getFactory() );

    OptionsServiceContext serviceContext = session.getFactory()
        .getServiceRegistry()
        .getService( OptionsService.class )
        .context();

    AssociationTypeContext associationTypeContext = new AssociationTypeContextImpl(
        serviceContext.getPropertyOptions( inversePersister.getMappedClass(), associationKeyMetadata.getCollectionRole() ),
        associationKeyMetadata.getAssociatedEntityKeyMetadata(),
        getPropertyNames()[propertyIndex]
    );

    AssociationPersister associationPersister = new AssociationPersister(
View Full Code Here

  public PackagingRule packaging = new PackagingRule( "persistencexml/jpajtastandalone-options.xml", Refrigerator.class );

  @Test
  public void shouldApplyOptionConfiguratorSpecifiedInPersistenceXml() throws Exception {
    final EntityManagerFactory emf = Persistence.createEntityManagerFactory( "jpajtastandalone-options" );
    OptionsServiceContext optionsContext = getOptionsContext( emf );

    OptionsContext refrigatorOptions = optionsContext.getEntityOptions( Refrigerator.class );
    assertThat( refrigatorOptions.getUnique( ForceExampleOption.class ) ).isTrue();

    OptionsContext microwaveOptions = optionsContext.getEntityOptions( Microwave.class );
    assertThat( microwaveOptions.getUnique( NameExampleOption.class ) ).isEqualTo( "test" );

    OptionsContext temperatureOptions = optionsContext.getPropertyOptions( Refrigerator.class, "temperature" );
    assertThat( temperatureOptions.getUnique( EmbedExampleOption.class ) ).isEqualTo( "Embedded" );

    dropSchemaAndDatabase( emf );
    emf.close();
  }
View Full Code Here

    return hostingEntityPersister;
  }

  public AssociationContext getAssociationContext() {
    if ( associationContext == null ) {
      OptionsServiceContext serviceContext = session.getFactory()
          .getServiceRegistry()
          .getService( OptionsService.class )
          .context();

      associationContext = new AssociationContext(
          serviceContext.getPropertyOptions( hostingEntityType, getAssociationKey().getCollectionRole() )
      );
    }

    return associationContext;
  }
View Full Code Here

    return hostingEntityPersister;
  }

  public AssociationContext getAssociationContext() {
    if ( associationContext == null ) {
      OptionsServiceContext serviceContext = session.getFactory()
          .getServiceRegistry()
          .getService( OptionsService.class )
          .context();

      associationContext = new AssociationContext(
          serviceContext.getPropertyOptions( hostingEntityType, getAssociationKey().getCollectionRole() )
      );
    }

    return associationContext;
  }
View Full Code Here

    return hostingEntityPersister;
  }

  public AssociationContext getAssociationContext() {
    if ( associationContext == null ) {
      OptionsServiceContext serviceContext = session.getFactory()
          .getServiceRegistry()
          .getService( OptionsService.class )
          .context();

      associationContext = new AssociationContext(
          serviceContext.getPropertyOptions( hostingEntityType, getAssociationKey().getCollectionRole() )
      );
    }

    return associationContext;
  }
View Full Code Here

    return hostingEntityPersister;
  }

  public AssociationContext getAssociationContext() {
    if ( associationContext == null ) {
      OptionsServiceContext serviceContext = session.getFactory()
          .getServiceRegistry()
          .getService( OptionsService.class )
          .context();

      associationContext = new AssociationContext(
View Full Code Here

   * Returns an {@link AssociationContext} to be passed to {@link GridDialect} operations targeting the association
   * managed by this persister.
   */
  private AssociationContext getAssociationContext() {
    if ( associationContext == null ) {
      OptionsServiceContext serviceContext = session.getFactory()
          .getServiceRegistry()
          .getService( OptionsService.class )
          .context();

      associationContext = new AssociationContext(
          serviceContext.getPropertyOptions( hostingEntityType, getAssociationKey().getMetadata().getCollectionRole() ),
          associationKeyMetadata.getAssociatedEntityKeyMetadata(),
          roleOnMainSide
      );
    }

View Full Code Here

TOP

Related Classes of org.hibernate.ogm.options.spi.OptionsService.OptionsServiceContext

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.