All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.hibernate.hql.internal.CollectionSubqueryFactory Maven / Gradle / Ivy

There is a newer version: 6.5.0.CR2
Show newest version
/*
 * Hibernate, Relational Persistence for Idiomatic Java
 *
 * License: GNU Lesser General Public License (LGPL), version 2.1 or later.
 * See the lgpl.txt file in the root directory or .
 */
package org.hibernate.hql.internal;

import java.util.Map;

import org.hibernate.MappingException;
import org.hibernate.QueryException;
import org.hibernate.engine.internal.JoinSequence;
import org.hibernate.sql.JoinFragment;

/**
 * Provides the SQL for collection subqueries.
 * 
* Moved here from PathExpressionParser to make it re-useable. * * @author josh */ public final class CollectionSubqueryFactory { private CollectionSubqueryFactory() { } public static String createCollectionSubquery( JoinSequence joinSequence, Map enabledFilters, String[] columns) { try { JoinFragment join = joinSequence.toJoinFragment( enabledFilters, true ); return "select " + String.join( ", ", columns ) + " from " + join.toFromFragmentString().substring( 2 ) + " where " + join.toWhereFragmentString().substring( 5 ); } catch (MappingException me) { throw new QueryException( me ); } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy