Package org.hibernate.search.annotations

Examples of org.hibernate.search.annotations.ProvidedId


    initializeMembers( clazz, rootPropertiesMetadata, true, "", processedClasses, context );
    //processedClasses.remove( clazz ); for the sake of completness
    this.analyzer.setGlobalAnalyzer( rootPropertiesMetadata.analyzer );
    if ( entityState == EntityState.INDEXED && idKeywordName == null ) {
      // if no DocumentId then check if we have a ProvidedId instead
      ProvidedId provided = findProvidedId( clazz, reflectionManager );
      if ( provided == null ) throw new SearchException( "No document id in: " + clazz.getName() );

      idBridge = BridgeFactory.extractTwoWayType( provided.bridge() );
      idKeywordName = provided.name();
    }

    //if composite id, use of (a, b) in ((1,2)TwoWayString2FieldBridgeAdaptor, (3,4)) fails on most database
    //a TwoWayString2FieldBridgeAdaptor is never a composite id
    safeFromTupleId = entityState != EntityState.INDEXED || TwoWayString2FieldBridgeAdaptor.class.isAssignableFrom( idBridge.getClass() );
View Full Code Here


  public boolean allowFieldSelectionInProjection() {
    return allowFieldSelectionInProjection;
  }

  private ProvidedId findProvidedId(XClass clazz, ReflectionManager reflectionManager) {
    ProvidedId id = null;
    XClass currentClass = clazz;
    while ( id == null && ( !reflectionManager.equals( currentClass, Object.class ) ) ) {
      id = currentClass.getAnnotation( ProvidedId.class );
      currentClass = clazz.getSuperclass();
    }
View Full Code Here

   */
  public DocumentBuilderIndexedEntity(XClass clazz, ConfigContext context, Similarity similarity,
      ReflectionManager reflectionManager, Set<XClass> optimizationBlackList, InstanceInitializer instanceInitializer) {
    super( clazz, context, similarity, reflectionManager, optimizationBlackList, instanceInitializer );
    // special case @ProvidedId
    ProvidedId provided = findProvidedId( clazz, reflectionManager );
    if ( provided != null ) {
      idBridge = BridgeFactory.extractTwoWayType( provided.bridge(), clazz, reflectionManager );
      idKeywordName = provided.name();
      idProvided = true;
    }
    else if ( context.isProvidedIdImplicit() ) {
      idBridge =  new TwoWayString2FieldBridgeAdaptor( org.hibernate.search.bridge.builtin.StringBridge.INSTANCE );
      idKeywordName = ProvidedId.defaultFieldName;
View Full Code Here

    }
    return idAnnotation;
  }

  private ProvidedId findProvidedId(XClass clazz, ReflectionManager reflectionManager) {
    ProvidedId id = null;
    XClass currentClass = clazz;
    while ( id == null && ( !reflectionManager.equals( currentClass, Object.class ) ) ) {
      id = currentClass.getAnnotation( ProvidedId.class );
      currentClass = currentClass.getSuperclass();
    }
View Full Code Here

    return idGetter;
  }

  protected void initSubClass(XClass clazz, ConfigContext context) {
    // special case @ProvidedId
    ProvidedId provided = findProvidedId( clazz, reflectionManager );
    if ( provided != null ) {
      idBridge = BridgeFactory.extractTwoWayType( provided.bridge(), clazz, reflectionManager );
      idKeywordName = provided.name();
      idProvided = true;
    }

    if ( idKeywordName == null ) {
      throw new SearchException( "No document id in: " + clazz.getName() );
View Full Code Here

    }
    return idAnnotation;
  }

  private ProvidedId findProvidedId(XClass clazz, ReflectionManager reflectionManager) {
    ProvidedId id = null;
    XClass currentClass = clazz;
    while ( id == null && ( !reflectionManager.equals( currentClass, Object.class ) ) ) {
      id = currentClass.getAnnotation( ProvidedId.class );
      currentClass = currentClass.getSuperclass();
    }
View Full Code Here

    initializeMembers( clazz, rootPropertiesMetadata, true, "", processedClasses, context );
    //processedClasses.remove( clazz ); for the sake of completness
    this.analyzer.setGlobalAnalyzer( rootPropertiesMetadata.analyzer );
    if ( entityState == EntityState.INDEXED && idKeywordName == null ) {
      // if no DocumentId then check if we have a ProvidedId instead
      ProvidedId provided = findProvidedId( clazz, reflectionManager );
      if ( provided == null ) throw new SearchException( "No document id in: " + clazz.getName() );

      idBridge = BridgeFactory.extractTwoWayType( provided.bridge() );
      idKeywordName = provided.name();
    }
    //if composite id, use of (a, b) in ((1,2)TwoWayString2FieldBridgeAdaptor, (3,4)) fails on most database
    //a TwoWayString2FieldBridgeAdaptor is never a composite id
    safeFromTupleId = entityState != EntityState.INDEXED || TwoWayString2FieldBridgeAdaptor.class.isAssignableFrom( idBridge.getClass() );
  }
View Full Code Here

      this.entityState = EntityState.NON_INDEXABLE;
    }
  }

  private ProvidedId findProvidedId(XClass clazz, ReflectionManager reflectionManager) {
    ProvidedId id = null;
    XClass currentClass = clazz;
    while ( id == null && ( !reflectionManager.equals( currentClass, Object.class ) ) ) {
      id = currentClass.getAnnotation( ProvidedId.class );
      currentClass = clazz.getSuperclass();
    }
View Full Code Here

   */
  public DocumentBuilderIndexedEntity(XClass clazz, ConfigContext context, Similarity similarity,
      ReflectionManager reflectionManager, Set<XClass> optimizationBlackList, InstanceInitializer instanceInitializer) {
    super( clazz, context, similarity, reflectionManager, optimizationBlackList, instanceInitializer );
    // special case @ProvidedId
    ProvidedId provided = findProvidedId( clazz, reflectionManager );
    if ( provided != null ) {
      idBridge = BridgeFactory.extractTwoWayType( provided.bridge(), clazz, reflectionManager );
      idKeywordName = provided.name();
      idProvided = true;
    }
    if ( idKeywordName == null ) {
      throw new SearchException( "No document id in: " + clazz );
    }
View Full Code Here

    }
    return idAnnotation;
  }

  private ProvidedId findProvidedId(XClass clazz, ReflectionManager reflectionManager) {
    ProvidedId id = null;
    XClass currentClass = clazz;
    while ( id == null && ( !reflectionManager.equals( currentClass, Object.class ) ) ) {
      id = currentClass.getAnnotation( ProvidedId.class );
      currentClass = currentClass.getSuperclass();
    }
View Full Code Here

TOP

Related Classes of org.hibernate.search.annotations.ProvidedId

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.