|
8 | 8 | import java.util.concurrent.CompletableFuture; |
9 | 9 | import java.util.concurrent.CompletionStage; |
10 | 10 |
|
| 11 | +import org.hibernate.DetachedObjectException; |
11 | 12 | import org.hibernate.HibernateException; |
12 | 13 | import org.hibernate.LockMode; |
13 | 14 | import org.hibernate.LockOptions; |
14 | | -import org.hibernate.PersistentObjectException; |
15 | 15 | import org.hibernate.UnresolvableObjectException; |
16 | 16 | import org.hibernate.cache.spi.access.CollectionDataAccess; |
17 | 17 | import org.hibernate.cache.spi.access.EntityDataAccess; |
@@ -110,21 +110,7 @@ private CompletionStage<Void> reactiveOnRefresh(RefreshEvent event, RefreshConte |
110 | 110 | final EntityPersister persister; |
111 | 111 | final Object id; |
112 | 112 | if ( entry == null ) { |
113 | | - //refresh() does not pass an entityName |
114 | | - persister = source.getEntityPersister( event.getEntityName(), entity ); |
115 | | - id = persister.getIdentifier( entity, event.getSession() ); |
116 | | - if ( LOG.isTraceEnabled() ) { |
117 | | - LOG.tracev( |
118 | | - "Refreshing transient {0}", |
119 | | - infoString( persister, id, source.getFactory() ) |
120 | | - ); |
121 | | - } |
122 | | - if ( persistenceContext.getEntry( source.generateEntityKey( id, persister ) ) != null ) { |
123 | | - throw new PersistentObjectException( |
124 | | - "attempted to refresh transient instance when persistent instance was already associated with the session: " |
125 | | - + infoString( persister, id, source.getFactory() ) |
126 | | - ); |
127 | | - } |
| 113 | + throw new DetachedObjectException( "Given entity is not associated with the persistence context" ); |
128 | 114 | } |
129 | 115 | else { |
130 | 116 | if ( LOG.isTraceEnabled() ) { |
|
0 commit comments