Methods Summary |
---|
public org.hibernate.Query | createQuery(java.lang.String queryString)
errorIfClosed();
QueryImpl query = new QueryImpl(
queryString,
this,
getHQLQueryPlan( queryString, false ).getParameterMetadata()
);
query.setComment( queryString );
return query;
|
public org.hibernate.SQLQuery | createSQLQuery(java.lang.String sql)
errorIfClosed();
SQLQueryImpl query = new SQLQueryImpl(
sql,
this,
factory.getQueryPlanCache().getSQLParameterMetadata( sql )
);
query.setComment( "dynamic native SQL query" );
return query;
|
protected void | errorIfClosed()
if ( closed ) {
throw new SessionException( "Session is closed!" );
}
|
public org.hibernate.engine.SessionFactoryImplementor | getFactory()
return factory;
|
protected org.hibernate.engine.query.HQLQueryPlan | getHQLQueryPlan(java.lang.String query, boolean shallow)
return factory.getQueryPlanCache().getHQLQueryPlan( query, shallow, getEnabledFilters() );
|
public org.hibernate.Query | getNamedQuery(java.lang.String queryName)
errorIfClosed();
NamedQueryDefinition nqd = factory.getNamedQuery( queryName );
final Query query;
if ( nqd != null ) {
String queryString = nqd.getQueryString();
query = new QueryImpl(
queryString,
nqd.getFlushMode(),
this,
getHQLQueryPlan( queryString, false ).getParameterMetadata()
);
query.setComment( "named HQL query " + queryName );
}
else {
NamedSQLQueryDefinition nsqlqd = factory.getNamedSQLQuery( queryName );
if ( nsqlqd==null ) {
throw new MappingException( "Named query not known: " + queryName );
}
query = new SQLQueryImpl(
nsqlqd,
this,
factory.getQueryPlanCache().getSQLParameterMetadata( nsqlqd.getQueryString() )
);
query.setComment( "named native SQL query " + queryName );
nqd = nsqlqd;
}
initQuery( query, nqd );
return query;
|
public org.hibernate.Query | getNamedSQLQuery(java.lang.String queryName)
errorIfClosed();
NamedSQLQueryDefinition nsqlqd = factory.getNamedSQLQuery( queryName );
if ( nsqlqd==null ) {
throw new MappingException( "Named SQL query not known: " + queryName );
}
Query query = new SQLQueryImpl(
nsqlqd,
this,
factory.getQueryPlanCache().getSQLParameterMetadata( nsqlqd.getQueryString() )
);
query.setComment( "named native SQL query " + queryName );
initQuery( query, nsqlqd );
return query;
|
protected org.hibernate.engine.query.NativeSQLQueryPlan | getNativeSQLQueryPlan(org.hibernate.engine.query.sql.NativeSQLQuerySpecification spec)
return factory.getQueryPlanCache().getNativeSQLQueryPlan( spec );
|
private void | initQuery(org.hibernate.Query query, org.hibernate.engine.NamedQueryDefinition nqd)
query.setCacheable( nqd.isCacheable() );
query.setCacheRegion( nqd.getCacheRegion() );
if ( nqd.getTimeout()!=null ) query.setTimeout( nqd.getTimeout().intValue() );
if ( nqd.getFetchSize()!=null ) query.setFetchSize( nqd.getFetchSize().intValue() );
if ( nqd.getCacheMode() != null ) query.setCacheMode( nqd.getCacheMode() );
query.setReadOnly( nqd.isReadOnly() );
if ( nqd.getComment() != null ) query.setComment( nqd.getComment() );
|
public boolean | isClosed()
return closed;
|
public java.util.List | list(org.hibernate.engine.query.sql.NativeSQLQuerySpecification spec, org.hibernate.engine.QueryParameters queryParameters)
return listCustomQuery( getNativeSQLQueryPlan( spec ).getCustomQuery(), queryParameters );
|
public org.hibernate.ScrollableResults | scroll(org.hibernate.engine.query.sql.NativeSQLQuerySpecification spec, org.hibernate.engine.QueryParameters queryParameters)
return scrollCustomQuery( getNativeSQLQueryPlan( spec ).getCustomQuery(), queryParameters );
|
protected void | setClosed()
closed = true;
|