Created
March 25, 2017 05:06
-
-
Save eleumik/c25665a785c7d089fb3890daf8b4e4c0 to your computer and use it in GitHub Desktop.
HibernateQueryCompatibility
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.hibernate.Query; | |
import org.hibernate.SQLQuery; | |
import org.hibernate.Session; | |
/** | |
* Abstracts the operations on queries | |
* for compatibility reasons. | |
* @author michele vivoda | |
* | |
*/ | |
public abstract class HibernateQueryCompatibility | |
{ | |
/** | |
* Subclasses only constructor. | |
*/ | |
protected HibernateQueryCompatibility() | |
{ | |
// | |
} | |
/** | |
* Creates a {@link Query}. See {@link Session#createQuery(String)}. | |
* @param session a {@link Session}, never <code>null</code>. | |
* @param hql required HQL | |
* @return a {@link Query}, never <code>null</code>. | |
*/ | |
public abstract Query createQuery(Session session, String hql); | |
/** | |
* Creates a {@link SQLQuery}. See {@link Session#createSQLQuery(String)}. | |
* @param session a {@link Session}, never <code>null</code>. | |
* @param sql required SQL | |
* @return a {@link SQLQuery}, never <code>null</code>. | |
*/ | |
public abstract SQLQuery createSQLQuery(Session session, String sql); | |
/** | |
* Creates a named {@link Query}. See {@link Session#getNamedQuery(String)} | |
* @param session a {@link Session}, never <code>null</code>. | |
* @param name required name | |
* @return a {@link Query}, never <code>null</code>. | |
*/ | |
public abstract Query getNamedQuery(Session session, String name); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment