Package org.hibernate.search.jpa

Source Code of org.hibernate.search.jpa.Search

/*
* Hibernate Search, full-text search for your domain model
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.search.jpa;

import javax.persistence.EntityManager;

import org.hibernate.search.jpa.impl.FullTextEntityManagerImpl;

/**
* Helper class that should be used when building a FullTextEntityManager
*
* @author Emmanuel Bernard
* @author Hardy Ferentschik
*/
public final class Search {

  private Search() {
  }

  /**
   * Build a full text capable EntityManager
   * The underlying EM implementation has to be Hibernate EntityManager
   */
  public static FullTextEntityManager getFullTextEntityManager(EntityManager em) {
    if ( em instanceof FullTextEntityManager ) {
      return (FullTextEntityManager) em;
    }
    else {
      return new FullTextEntityManagerImpl( em );
    }
  }

}
TOP

Related Classes of org.hibernate.search.jpa.Search

TOP
Copyright © 2018 www.massapi.com. 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.