HHH-4412 Cleanup and copyrights

Conflicts:
	hibernate-core/src/main/java/org/hibernate/cfg/annotations/QueryBinder.java
This commit is contained in:
Brett Meyer 2013-03-06 09:49:10 -05:00
parent 4970d80007
commit 9edc30f9f0
4 changed files with 80 additions and 12 deletions

View File

@ -96,10 +96,12 @@ public static void bindNativeQuery(NamedNativeQuery queryAnn, Mappings mappings,
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();
NamedSQLQueryDefinition query;
if ( !BinderHelper.isEmptyAnnotationValue( resultSetMapping ) ) { if ( !BinderHelper.isEmptyAnnotationValue( resultSetMapping ) ) {
//sql result set usage //sql result set usage
query = new NamedSQLQueryDefinition( query = new NamedSQLQueryDefinition(
@ -142,18 +144,24 @@ else if ( !void.class.equals( queryAnn.resultClass() ) ) {
); );
} }
else { else {
query = new NamedSQLQueryDefinitionBuilder( queryAnn.name() ).setQuery( queryName ) query = new NamedSQLQueryDefinition(
.setQueryReturns( new NativeSQLQueryReturn[0] ).setQuerySpaces( null ) queryAnn.name(),
.setCacheable( getBoolean( queryName, "org.hibernate.cacheable", hints ) ) queryName,
.setCacheRegion( getString( queryName, "org.hibernate.cacheRegion", hints ) ) new NativeSQLQueryReturn[0],
.setTimeout( getTimeout( queryName, hints ) ) null,
.setFetchSize( getInteger( queryName, "org.hibernate.fetchSize", hints ) ) getBoolean( queryName, "org.hibernate.cacheable", hints ),
.setFlushMode( getFlushMode( queryName, hints ) ).setCacheMode( getCacheMode( queryName, hints ) ) getString( queryName, "org.hibernate.cacheRegion", hints ),
.setReadOnly( getBoolean( queryName, "org.hibernate.readOnly", hints ) ) getTimeout( queryName, hints ),
.setComment( getString( queryName, "org.hibernate.comment", hints ) ).setParameterTypes( null ) getInteger( queryName, "org.hibernate.fetchSize", hints ),
.setCallable( getBoolean( queryName, "org.hibernate.callable", hints ) ) getFlushMode( queryName, hints ),
.createNamedQueryDefinition(); getCacheMode( queryName, hints ),
getBoolean( queryName, "org.hibernate.readOnly", hints ),
getString( queryName, "org.hibernate.comment", hints ),
null,
getBoolean( queryName, "org.hibernate.callable", hints )
);
} }
if ( isDefault ) { if ( isDefault ) {
mappings.addDefaultSQLQuery( query.getName(), query ); mappings.addDefaultSQLQuery( query.getName(), query );
} }

View File

@ -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;

View File

@ -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;

View File

@ -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;