Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## net.java.ao
Interface RelatedEntity<T extends RelatedEntity<T> & RawEntity<?>>

    public interface RelatedEntity<T extends RelatedEntity<T> & RawEntity<?>>

A superinterface for entities which are related to each other using Lucene heuristics. This is not required as a superinterface for entities related to one another at the database level. Thus, this interface is only relevant to those already using full-text indexing.

While this entity does not extend `RawEntity` itself, it should only be inherited by interfaces which do. In fact, this is enforced by the type parameterization of this interface. Example:

    public interface Post extends Entity, RelatedEntity<Post> {
         // ...

         @Searchable
         @SQLType(Types.BLOB)
         public String getBody();

         @Searchable
         @SQLType(Types.BLOB)
         public void setBody(String body);
     }

     // ...
     Post p = manager.get(Post.class, 123);
     Post[] relatedPosts = p.getRelated();      // searches Lucene index for related posts

Under most circumstances, the type parameter used when inheriting from this interface should be the entity interface itself, as in the above example.

Author:
  Daniel Spiewak
See Also:
  `SearchableEntityManager`

Method Summary
`T[]` | `getRelated()` Retrieves the entities related to this by using full-text search heuristics.

Method Detail

### getRelated

    T[] getRelated()

  Retrieves the entities related to this by using full-text search heuristics. No database invocation is involved in calling this method. Also, the results are uncached, relying instead on the underlying performance optimizations of Lucene itself.

  Returns:
    Any entities of the relevant type which relate to the current instance in the full-text index.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2007-2011. All Rights Reserved.