org.hibernate.search.Search Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hibernate-search-v5migrationhelper-orm Show documentation
Show all versions of hibernate-search-v5migrationhelper-orm Show documentation
Helper to migrate from Hibernate Search 5 to 6, providing partial support for Hibernate Search 5 ORM APIs on top of Hibernate Search 6
The newest version!
/*
* SPDX-License-Identifier: Apache-2.0
* Copyright Red Hat Inc. and Hibernate Authors
*/
package org.hibernate.search;
import java.lang.invoke.MethodHandles;
import org.hibernate.Session;
import org.hibernate.search.impl.ImplementationFactory;
import org.hibernate.search.util.logging.impl.LoggerFactory;
import org.hibernate.search.util.logging.impl.MigrationHelperLog;
/**
* Helper class to get a {@code FullTextSession} from a regular ORM session.
*
* @author Emmanuel Bernard
* @author Hardy Ferentschik
* @deprecated Use {@link org.hibernate.search.mapper.orm.Search} instead.
*/
@Deprecated
public final class Search {
private static final MigrationHelperLog log = LoggerFactory.make( MethodHandles.lookup() );
private Search() {
}
/**
* Creates a FullTextSession from a regular Session.
* The created instance depends on the passed Session: closing either of them will
* close both instances. They both share the same persistence context.
*
* @param session the hibernate ORM session
* @return the new FullTextSession, based on the passed Session
* @throws IllegalArgumentException if passed null
* @deprecated Use {@link org.hibernate.search.mapper.orm.Search#session(Session)} instead.
*/
@Deprecated
public static FullTextSession getFullTextSession(Session session) {
if ( session == null ) {
throw log.getNullSessionPassedToFullTextSessionCreationException();
}
else if ( session instanceof FullTextSession ) {
return (FullTextSession) session;
}
else {
return ImplementationFactory.createFullTextSession( session );
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy