Include all Hibernate methods in SharedEntityManagerCreator's queryTerminatingMethods
Prior to this commit, we included Hibernate's Query.list() method in SharedEntityManagerCreator's queryTerminatingMethods set but did not include all of Hibernate's query-terminating methods. To address this, this commit additionally includes the stream(), uniqueResult(), and uniqueResultOptional() methods from Hibernate's Query API in SharedEntityManagerCreator's query-terminating methods set. Closes gh-29886
This commit is contained in:
		
							parent
							
								
									75046bbea0
								
							
						
					
					
						commit
						57fb072215
					
				|  | @ -1,5 +1,5 @@ | ||||||
| /* | /* | ||||||
|  * Copyright 2002-2022 the original author or authors. |  * Copyright 2002-2023 the original author or authors. | ||||||
|  * |  * | ||||||
|  * Licensed under the Apache License, Version 2.0 (the "License"); |  * Licensed under the Apache License, Version 2.0 (the "License"); | ||||||
|  * you may not use this file except in compliance with the License. |  * you may not use this file except in compliance with the License. | ||||||
|  | @ -60,6 +60,7 @@ import org.springframework.util.ConcurrentReferenceHashMap; | ||||||
|  * @author Rod Johnson |  * @author Rod Johnson | ||||||
|  * @author Oliver Gierke |  * @author Oliver Gierke | ||||||
|  * @author Mark Paluch |  * @author Mark Paluch | ||||||
|  |  * @author Sam Brannen | ||||||
|  * @since 2.0 |  * @since 2.0 | ||||||
|  * @see jakarta.persistence.PersistenceContext |  * @see jakarta.persistence.PersistenceContext | ||||||
|  * @see jakarta.persistence.PersistenceContextType#TRANSACTION |  * @see jakarta.persistence.PersistenceContextType#TRANSACTION | ||||||
|  | @ -81,12 +82,15 @@ public abstract class SharedEntityManagerCreator { | ||||||
| 			"refresh"); | 			"refresh"); | ||||||
| 
 | 
 | ||||||
| 	private static final Set<String> queryTerminatingMethods = Set.of( | 	private static final Set<String> queryTerminatingMethods = Set.of( | ||||||
| 			"execute",  // JPA 2.1 StoredProcedureQuery | 			"execute",  // jakarta.persistence.StoredProcedureQuery.execute() | ||||||
| 			"executeUpdate", | 			"executeUpdate", // jakarta.persistence.Query.executeUpdate() | ||||||
| 			"getSingleResult", | 			"getSingleResult",  // jakarta.persistence.Query.getSingleResult() | ||||||
| 			"getResultStream", | 			"getResultStream",  // jakarta.persistence.Query.getResultStream() | ||||||
| 			"getResultList", | 			"getResultList",  // jakarta.persistence.Query.getResultList() | ||||||
| 			"list"  // Hibernate Query.list() method | 			"list",  // org.hibernate.query.Query.list() | ||||||
|  | 			"stream",  // org.hibernate.query.Query.stream() | ||||||
|  | 			"uniqueResult",  // org.hibernate.query.Query.uniqueResult() | ||||||
|  | 			"uniqueResultOptional"  // org.hibernate.query.Query.uniqueResultOptional() | ||||||
| 		); | 		); | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue