Skip to content

Commit 25f374a

Browse files
committed
big cleanup to named query and native query handling
this was a mess!
1 parent 654b8b0 commit 25f374a

File tree

16 files changed

+312
-360
lines changed

16 files changed

+312
-360
lines changed

hibernate-core/src/main/java/org/hibernate/Hibernate.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ public static <E> E createDetachedProxy(SessionFactory sessionFactory, Class<E>
418418
.getMappingMetamodel()
419419
.findEntityDescriptor( entityClass );
420420
if ( persister == null ) {
421-
throw new UnknownEntityTypeException("unknown entity type");
421+
throw new UnknownEntityTypeException( entityClass );
422422
}
423423
return (E) persister.createProxy( id, null );
424424
}

hibernate-core/src/main/java/org/hibernate/UnknownEntityTypeException.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@ public UnknownEntityTypeException(String message, Throwable cause) {
1818
super( message, cause );
1919
}
2020

21-
public UnknownEntityTypeException(String message) {
22-
super( message );
21+
public UnknownEntityTypeException(String entityName) {
22+
super( "Unknown entity type: " + entityName );
23+
}
24+
25+
public UnknownEntityTypeException(Class<?> entityClass) {
26+
this( entityClass.getName() );
2327
}
2428
}

hibernate-core/src/main/java/org/hibernate/engine/spi/SessionDelegatorBaseImpl.java

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -546,13 +546,13 @@ public <T> QueryImplementor<T> createQuery(CriteriaQuery<T> criteriaQuery) {
546546
return queryDelegate().createQuery( criteriaQuery );
547547
}
548548

549-
@Override @SuppressWarnings("rawtypes")
550-
public QueryImplementor createQuery(CriteriaUpdate updateQuery) {
549+
@Override
550+
public @SuppressWarnings("rawtypes") QueryImplementor createQuery(CriteriaUpdate updateQuery) {
551551
return queryDelegate().createQuery( updateQuery );
552552
}
553553

554-
@Override @SuppressWarnings("rawtypes")
555-
public QueryImplementor createQuery(CriteriaDelete deleteQuery) {
554+
@Override
555+
public @SuppressWarnings("rawtypes") QueryImplementor createQuery(CriteriaDelete deleteQuery) {
556556
return queryDelegate().createQuery( deleteQuery );
557557
}
558558

@@ -561,18 +561,18 @@ public <T> QueryImplementor<T> createQuery(TypedQueryReference<T> typedQueryRefe
561561
return queryDelegate().createQuery( typedQueryReference );
562562
}
563563

564-
@Override @SuppressWarnings("rawtypes")
565-
public QueryImplementor getNamedQuery(String name) {
564+
@Override
565+
public @SuppressWarnings("rawtypes") QueryImplementor getNamedQuery(String name) {
566566
return queryDelegate().getNamedQuery( name );
567567
}
568568

569-
@Override @SuppressWarnings("rawtypes")
570-
public NativeQueryImplementor getNamedNativeQuery(String name) {
569+
@Override
570+
public @SuppressWarnings("rawtypes") NativeQueryImplementor getNamedNativeQuery(String name) {
571571
return queryDelegate().getNamedNativeQuery( name );
572572
}
573573

574-
@Override @SuppressWarnings("rawtypes")
575-
public NativeQueryImplementor getNamedNativeQuery(String name, String resultSetMapping) {
574+
@Override
575+
public @SuppressWarnings("rawtypes") NativeQueryImplementor getNamedNativeQuery(String name, String resultSetMapping) {
576576
return queryDelegate().getNamedNativeQuery( name, resultSetMapping );
577577
}
578578

@@ -601,8 +601,8 @@ public <T> QueryImplementor<T> createQuery(String queryString, Class<T> resultTy
601601
return queryDelegate().createQuery( queryString, resultType );
602602
}
603603

604-
@Override @SuppressWarnings("rawtypes")
605-
public QueryImplementor createNamedQuery(String name) {
604+
@Override
605+
public @SuppressWarnings("rawtypes") QueryImplementor createNamedQuery(String name) {
606606
return queryDelegate().createNamedQuery( name );
607607
}
608608

@@ -623,8 +623,8 @@ public <R> SelectionQuery<R> createNamedSelectionQuery(String name, Class<R> res
623623
return delegate().createNamedSelectionQuery( name, resultType );
624624
}
625625

626-
@Override @SuppressWarnings("rawtypes")
627-
public NativeQueryImplementor createNativeQuery(String sqlString) {
626+
@Override
627+
public @SuppressWarnings("rawtypes") NativeQueryImplementor createNativeQuery(String sqlString) {
628628
return queryDelegate().createNativeQuery( sqlString );
629629
}
630630

@@ -640,8 +640,8 @@ public <T> NativeQueryImplementor<T> createNativeQuery(String sqlString, Class<T
640640
return queryDelegate().createNativeQuery( sqlString, resultClass, tableAlias );
641641
}
642642

643-
@Override @SuppressWarnings("rawtypes")
644-
public NativeQueryImplementor createNativeQuery(String sqlString, String resultSetMappingName) {
643+
@Override
644+
public @SuppressWarnings("rawtypes") NativeQueryImplementor createNativeQuery(String sqlString, String resultSetMappingName) {
645645
return queryDelegate().createNativeQuery( sqlString, resultSetMappingName );
646646
}
647647

hibernate-core/src/main/java/org/hibernate/engine/spi/SharedSessionDelegatorBaseImpl.java

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -114,33 +114,33 @@ public <T> QueryImplementor<T> createQuery(CriteriaQuery<T> criteriaQuery) {
114114
return queryDelegate().createQuery( criteriaQuery );
115115
}
116116

117-
@Override @SuppressWarnings("rawtypes")
118-
public QueryImplementor createQuery(CriteriaUpdate updateQuery) {
117+
@Override
118+
public @SuppressWarnings("rawtypes") QueryImplementor createQuery(CriteriaUpdate updateQuery) {
119119
return queryDelegate().createQuery( updateQuery );
120120
}
121121

122-
@Override @SuppressWarnings("rawtypes")
123-
public QueryImplementor createQuery(CriteriaDelete deleteQuery) {
122+
@Override
123+
public @SuppressWarnings("rawtypes") QueryImplementor createQuery(CriteriaDelete deleteQuery) {
124124
return queryDelegate().createQuery( deleteQuery );
125125
}
126126

127-
@Override @SuppressWarnings("rawtypes")
128-
public QueryImplementor getNamedQuery(String name) {
127+
@Override
128+
public @SuppressWarnings("rawtypes") QueryImplementor getNamedQuery(String name) {
129129
return queryDelegate().getNamedQuery( name );
130130
}
131131

132-
@Override @SuppressWarnings("rawtypes")
133-
public NativeQueryImplementor getNamedNativeQuery(String name) {
132+
@Override
133+
public @SuppressWarnings("rawtypes") NativeQueryImplementor getNamedNativeQuery(String name) {
134134
return queryDelegate().getNamedNativeQuery( name );
135135
}
136136

137-
@Override @SuppressWarnings("rawtypes")
138-
public NativeQueryImplementor getNamedNativeQuery(String name, String resultSetMapping) {
137+
@Override
138+
public @SuppressWarnings("rawtypes") NativeQueryImplementor getNamedNativeQuery(String name, String resultSetMapping) {
139139
return queryDelegate().getNamedNativeQuery( name, resultSetMapping );
140140
}
141141

142-
@Override @SuppressWarnings("rawtypes")
143-
public QueryImplementor createQuery(String queryString) {
142+
@Override
143+
public @SuppressWarnings("rawtypes") QueryImplementor createQuery(String queryString) {
144144
return queryDelegate().createQuery( queryString );
145145
}
146146

@@ -169,8 +169,8 @@ public <R> QueryImplementor<R> createQuery(TypedQueryReference<R> typedQueryRefe
169169
return queryDelegate().createQuery( typedQueryReference );
170170
}
171171

172-
@Override @SuppressWarnings("rawtypes")
173-
public QueryImplementor createNamedQuery(String name) {
172+
@Override
173+
public @SuppressWarnings("rawtypes") QueryImplementor createNamedQuery(String name) {
174174
return queryDelegate().createNamedQuery( name );
175175
}
176176

@@ -191,8 +191,8 @@ public <R> SelectionQuery<R> createNamedSelectionQuery(String name, Class<R> res
191191
return delegate().createNamedSelectionQuery( name, resultType );
192192
}
193193

194-
@Override @SuppressWarnings("rawtypes")
195-
public NativeQueryImplementor createNativeQuery(String sqlString) {
194+
@Override
195+
public @SuppressWarnings("rawtypes") NativeQueryImplementor createNativeQuery(String sqlString) {
196196
return queryDelegate().createNativeQuery( sqlString );
197197
}
198198

@@ -208,8 +208,8 @@ public <T> NativeQueryImplementor<T> createNativeQuery(String sqlString, Class<T
208208
return queryDelegate().createNativeQuery( sqlString, resultClass, tableAlias );
209209
}
210210

211-
@Override @SuppressWarnings("rawtypes")
212-
public NativeQueryImplementor createNativeQuery(String sqlString, String resultSetMappingName) {
211+
@Override
212+
public @SuppressWarnings("rawtypes") NativeQueryImplementor createNativeQuery(String sqlString, String resultSetMappingName) {
213213
return queryDelegate().createNativeQuery( sqlString, resultSetMappingName );
214214
}
215215

0 commit comments

Comments
 (0)