HHH-4412 Cleanup and copyrights
This commit is contained in:
parent
6cda7dc577
commit
31f43e3321
|
@ -114,26 +114,27 @@ public abstract class QueryBinder {
|
||||||
if ( BinderHelper.isEmptyAnnotationValue( queryAnn.name() ) ) {
|
if ( BinderHelper.isEmptyAnnotationValue( queryAnn.name() ) ) {
|
||||||
throw new AnnotationException( "A named query must have a name when used in class or package level" );
|
throw new AnnotationException( "A named query must have a name when used in class or package level" );
|
||||||
}
|
}
|
||||||
NamedSQLQueryDefinition query;
|
|
||||||
String resultSetMapping = queryAnn.resultSetMapping();
|
String resultSetMapping = queryAnn.resultSetMapping();
|
||||||
QueryHint[] hints = queryAnn.hints();
|
QueryHint[] hints = queryAnn.hints();
|
||||||
String queryName = queryAnn.query();
|
String queryName = queryAnn.query();
|
||||||
|
|
||||||
|
NamedSQLQueryDefinitionBuilder builder = new NamedSQLQueryDefinitionBuilder( queryAnn.name() )
|
||||||
|
.setQuery( queryName )
|
||||||
|
.setQuerySpaces( null )
|
||||||
|
.setCacheable( getBoolean( queryName, "org.hibernate.cacheable", hints ) )
|
||||||
|
.setCacheRegion( getString( queryName, "org.hibernate.cacheRegion", hints ) )
|
||||||
|
.setTimeout( getTimeout( queryName, hints ) )
|
||||||
|
.setFetchSize( getInteger( queryName, "org.hibernate.fetchSize", hints ) )
|
||||||
|
.setFlushMode( getFlushMode( queryName, hints ) )
|
||||||
|
.setCacheMode( getCacheMode( queryName, hints ) )
|
||||||
|
.setReadOnly( getBoolean( queryName, "org.hibernate.readOnly", hints ) )
|
||||||
|
.setComment( getString( queryName, "org.hibernate.comment", hints ) )
|
||||||
|
.setParameterTypes( null )
|
||||||
|
.setCallable( getBoolean( queryName, "org.hibernate.callable", hints ) );
|
||||||
|
|
||||||
if ( !BinderHelper.isEmptyAnnotationValue( resultSetMapping ) ) {
|
if ( !BinderHelper.isEmptyAnnotationValue( resultSetMapping ) ) {
|
||||||
//sql result set usage
|
//sql result set usage
|
||||||
query = new NamedSQLQueryDefinitionBuilder( queryAnn.name() )
|
builder.setResultSetRef( resultSetMapping )
|
||||||
.setQuery( queryName )
|
|
||||||
.setResultSetRef( resultSetMapping )
|
|
||||||
.setQuerySpaces( null )
|
|
||||||
.setCacheable( getBoolean( queryName, "org.hibernate.cacheable", hints ) )
|
|
||||||
.setCacheRegion( getString( queryName, "org.hibernate.cacheRegion", hints ) )
|
|
||||||
.setTimeout( getTimeout( queryName, hints ) )
|
|
||||||
.setFetchSize( getInteger( queryName, "org.hibernate.fetchSize", hints ) )
|
|
||||||
.setFlushMode( getFlushMode( queryName, hints ) )
|
|
||||||
.setCacheMode( getCacheMode( queryName, hints ) )
|
|
||||||
.setReadOnly( getBoolean( queryName, "org.hibernate.readOnly", hints ) )
|
|
||||||
.setComment( getString( queryName, "org.hibernate.comment", hints ) )
|
|
||||||
.setParameterTypes( null )
|
|
||||||
.setCallable( getBoolean( queryName, "org.hibernate.callable", hints ) )
|
|
||||||
.createNamedQueryDefinition();
|
.createNamedQueryDefinition();
|
||||||
}
|
}
|
||||||
else if ( !void.class.equals( queryAnn.resultClass() ) ) {
|
else if ( !void.class.equals( queryAnn.resultClass() ) ) {
|
||||||
|
@ -141,35 +142,14 @@ public abstract class QueryBinder {
|
||||||
//FIXME should be done in a second pass due to entity name?
|
//FIXME should be done in a second pass due to entity name?
|
||||||
final NativeSQLQueryRootReturn entityQueryReturn =
|
final NativeSQLQueryRootReturn entityQueryReturn =
|
||||||
new NativeSQLQueryRootReturn( "alias1", queryAnn.resultClass().getName(), new HashMap(), LockMode.READ );
|
new NativeSQLQueryRootReturn( "alias1", queryAnn.resultClass().getName(), new HashMap(), LockMode.READ );
|
||||||
query = new NamedSQLQueryDefinitionBuilder( queryAnn.name() )
|
builder.setQueryReturns( new NativeSQLQueryReturn[] {entityQueryReturn} );
|
||||||
.setQuery( queryName )
|
|
||||||
.setQueryReturns( new NativeSQLQueryReturn[] {entityQueryReturn} )
|
|
||||||
.setQuerySpaces( null )
|
|
||||||
.setCacheable( getBoolean( queryName, "org.hibernate.cacheable", hints ) )
|
|
||||||
.setCacheRegion( getString( queryName, "org.hibernate.cacheRegion", hints ) )
|
|
||||||
.setTimeout( getTimeout( queryName, hints ) )
|
|
||||||
.setFetchSize( getInteger( queryName, "org.hibernate.fetchSize", hints ) )
|
|
||||||
.setFlushMode( getFlushMode( queryName, hints ) )
|
|
||||||
.setCacheMode( getCacheMode( queryName, hints ) )
|
|
||||||
.setReadOnly( getBoolean( queryName, "org.hibernate.readOnly", hints ) )
|
|
||||||
.setComment( getString( queryName, "org.hibernate.comment", hints ) )
|
|
||||||
.setParameterTypes( null )
|
|
||||||
.setCallable( getBoolean( queryName, "org.hibernate.callable", hints ) )
|
|
||||||
.createNamedQueryDefinition();
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
query = new NamedSQLQueryDefinitionBuilder( queryAnn.name() ).setQuery( queryName )
|
builder.setQueryReturns( new NativeSQLQueryReturn[0] );
|
||||||
.setQueryReturns( new NativeSQLQueryReturn[0] ).setQuerySpaces( null )
|
|
||||||
.setCacheable( getBoolean( queryName, "org.hibernate.cacheable", hints ) )
|
|
||||||
.setCacheRegion( getString( queryName, "org.hibernate.cacheRegion", hints ) )
|
|
||||||
.setTimeout( getTimeout( queryName, hints ) )
|
|
||||||
.setFetchSize( getInteger( queryName, "org.hibernate.fetchSize", hints ) )
|
|
||||||
.setFlushMode( getFlushMode( queryName, hints ) ).setCacheMode( getCacheMode( queryName, hints ) )
|
|
||||||
.setReadOnly( getBoolean( queryName, "org.hibernate.readOnly", hints ) )
|
|
||||||
.setComment( getString( queryName, "org.hibernate.comment", hints ) ).setParameterTypes( null )
|
|
||||||
.setCallable( getBoolean( queryName, "org.hibernate.callable", hints ) )
|
|
||||||
.createNamedQueryDefinition();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NamedSQLQueryDefinition query = builder.createNamedQueryDefinition();
|
||||||
|
|
||||||
if ( isDefault ) {
|
if ( isDefault ) {
|
||||||
mappings.addDefaultSQLQuery( query.getName(), query );
|
mappings.addDefaultSQLQuery( query.getName(), query );
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,23 @@
|
||||||
|
/*
|
||||||
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
|
*
|
||||||
|
* JBoss, Home of Professional Open Source
|
||||||
|
* Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
|
||||||
|
* as indicated by the @authors tag. All rights reserved.
|
||||||
|
* See the copyright.txt in the distribution for a
|
||||||
|
* full listing of individual contributors.
|
||||||
|
*
|
||||||
|
* This copyrighted material is made available to anyone wishing to use,
|
||||||
|
* modify, copy, or redistribute it subject to the terms and conditions
|
||||||
|
* of the GNU Lesser General Public License, v. 2.1.
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT A
|
||||||
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License,
|
||||||
|
* v.2.1 along with this distribution; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301, USA.
|
||||||
|
*/
|
||||||
package org.hibernate.test.jpa.ql;
|
package org.hibernate.test.jpa.ql;
|
||||||
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
|
|
|
@ -1,3 +1,23 @@
|
||||||
|
/*
|
||||||
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
|
*
|
||||||
|
* JBoss, Home of Professional Open Source
|
||||||
|
* Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
|
||||||
|
* as indicated by the @authors tag. All rights reserved.
|
||||||
|
* See the copyright.txt in the distribution for a
|
||||||
|
* full listing of individual contributors.
|
||||||
|
*
|
||||||
|
* This copyrighted material is made available to anyone wishing to use,
|
||||||
|
* modify, copy, or redistribute it subject to the terms and conditions
|
||||||
|
* of the GNU Lesser General Public License, v. 2.1.
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT A
|
||||||
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License,
|
||||||
|
* v.2.1 along with this distribution; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301, USA.
|
||||||
|
*/
|
||||||
package org.hibernate.test.jpa.ql;
|
package org.hibernate.test.jpa.ql;
|
||||||
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
|
|
|
@ -1,3 +1,23 @@
|
||||||
|
/*
|
||||||
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
|
*
|
||||||
|
* JBoss, Home of Professional Open Source
|
||||||
|
* Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
|
||||||
|
* as indicated by the @authors tag. All rights reserved.
|
||||||
|
* See the copyright.txt in the distribution for a
|
||||||
|
* full listing of individual contributors.
|
||||||
|
*
|
||||||
|
* This copyrighted material is made available to anyone wishing to use,
|
||||||
|
* modify, copy, or redistribute it subject to the terms and conditions
|
||||||
|
* of the GNU Lesser General Public License, v. 2.1.
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT A
|
||||||
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License,
|
||||||
|
* v.2.1 along with this distribution; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301, USA.
|
||||||
|
*/
|
||||||
package org.hibernate.test.jpa.ql;
|
package org.hibernate.test.jpa.ql;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
Loading…
Reference in New Issue