Skip to content

Commit cdc5e1e

Browse files
committed
HHH-19536 Refactoring step: separate state handling between EnhancementAsProxyLazinessInterceptor and LazyAttributeLoadingInterceptor
1 parent 46d98a9 commit cdc5e1e

File tree

3 files changed

+15
-9
lines changed

3 files changed

+15
-9
lines changed

hibernate-core/src/main/java/org/hibernate/bytecode/enhance/spi/interceptor/AbstractInterceptor.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,9 @@
1111
*/
1212
public abstract class AbstractInterceptor implements SessionAssociableInterceptor {
1313

14-
private final String entityName;
1514
private SessionAssociationMarkers sessionAssociation;
1615

17-
public AbstractInterceptor(String entityName) {
18-
this.entityName = entityName;
19-
}
20-
21-
public String getEntityName() {
22-
return entityName;
16+
protected AbstractInterceptor() {
2317
}
2418

2519
@Override

hibernate-core/src/main/java/org/hibernate/bytecode/enhance/spi/interceptor/EnhancementAsProxyLazinessInterceptor.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
public class EnhancementAsProxyLazinessInterceptor extends AbstractInterceptor implements BytecodeLazyAttributeInterceptor {
2929
private final Set<String> identifierAttributeNames;
3030
private final CompositeType nonAggregatedCidMapper;
31+
private final String entityName;
3132

3233
private final EntityKey entityKey;
3334

@@ -45,7 +46,7 @@ public EnhancementAsProxyLazinessInterceptor(
4546
CompositeType nonAggregatedCidMapper,
4647
EntityKey entityKey,
4748
SharedSessionContractImplementor session) {
48-
super( entityName );
49+
this.entityName = entityName;
4950

5051
this.identifierAttributeNames = identifierAttributeNames;
5152
assert identifierAttributeNames != null;
@@ -83,6 +84,11 @@ public EnhancementAsProxyLazinessInterceptor(
8384
status = Status.UNINITIALIZED;
8485
}
8586

87+
@Override
88+
public String getEntityName() {
89+
return entityName;
90+
}
91+
8692
public EntityKey getEntityKey() {
8793
return entityKey;
8894
}

hibernate-core/src/main/java/org/hibernate/bytecode/enhance/spi/interceptor/LazyAttributeLoadingInterceptor.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
*/
3030
public class LazyAttributeLoadingInterceptor extends AbstractInterceptor implements BytecodeLazyAttributeInterceptor {
3131
private final Object identifier;
32+
private final String entityName;
3233

3334
//N.B. this Set needs to be treated as immutable
3435
private Set<String> lazyFields;
@@ -40,12 +41,17 @@ public LazyAttributeLoadingInterceptor(
4041
Object identifier,
4142
Set<String> lazyFields,
4243
SharedSessionContractImplementor session) {
43-
super( entityName );
44+
this.entityName = entityName;
4445
this.identifier = identifier;
4546
this.lazyFields = lazyFields;
4647
setSession( session );
4748
}
4849

50+
@Override
51+
public String getEntityName() {
52+
return entityName;
53+
}
54+
4955
@Override
5056
public Object getIdentifier() {
5157
return identifier;

0 commit comments

Comments
 (0)