HHH-16049 Setting a property to its current value with bytecode enhancement enabled results in unnecessary SQL Update in some (many) cases
This commit is contained in:
parent
3d9a1bce9b
commit
0983b47252
|
@ -20,7 +20,7 @@ public final class InlineDirtyCheckerEqualsHelper {
|
|||
Object b) {
|
||||
final PersistentAttributeInterceptor persistentAttributeInterceptor = persistentAttributeInterceptable.$$_hibernate_getInterceptor();
|
||||
if ( persistentAttributeInterceptor != null
|
||||
&& !persistentAttributeInterceptor.getInitializedLazyAttributeNames().contains( fieldName ) ) {
|
||||
&& !persistentAttributeInterceptor.isAttributeLoaded( fieldName ) ) {
|
||||
return false;
|
||||
}
|
||||
return Objects.deepEquals( a, b );
|
||||
|
@ -33,7 +33,7 @@ public final class InlineDirtyCheckerEqualsHelper {
|
|||
boolean b) {
|
||||
final PersistentAttributeInterceptor persistentAttributeInterceptor = persistentAttributeInterceptable.$$_hibernate_getInterceptor();
|
||||
if ( persistentAttributeInterceptor != null
|
||||
&& !persistentAttributeInterceptor.getInitializedLazyAttributeNames().contains( fieldName ) ) {
|
||||
&& !persistentAttributeInterceptor.isAttributeLoaded( fieldName ) ) {
|
||||
return false;
|
||||
}
|
||||
return a == b;
|
||||
|
@ -46,7 +46,7 @@ public final class InlineDirtyCheckerEqualsHelper {
|
|||
byte b) {
|
||||
final PersistentAttributeInterceptor persistentAttributeInterceptor = persistentAttributeInterceptable.$$_hibernate_getInterceptor();
|
||||
if ( persistentAttributeInterceptor != null
|
||||
&& !persistentAttributeInterceptor.getInitializedLazyAttributeNames().contains( fieldName ) ) {
|
||||
&& !persistentAttributeInterceptor.isAttributeLoaded( fieldName ) ) {
|
||||
return false;
|
||||
}
|
||||
return a == b;
|
||||
|
@ -59,7 +59,7 @@ public final class InlineDirtyCheckerEqualsHelper {
|
|||
short b) {
|
||||
final PersistentAttributeInterceptor persistentAttributeInterceptor = persistentAttributeInterceptable.$$_hibernate_getInterceptor();
|
||||
if ( persistentAttributeInterceptor != null
|
||||
&& !persistentAttributeInterceptor.getInitializedLazyAttributeNames().contains( fieldName ) ) {
|
||||
&& !persistentAttributeInterceptor.isAttributeLoaded( fieldName ) ) {
|
||||
return false;
|
||||
}
|
||||
return a == b;
|
||||
|
@ -72,7 +72,7 @@ public final class InlineDirtyCheckerEqualsHelper {
|
|||
char b) {
|
||||
final PersistentAttributeInterceptor persistentAttributeInterceptor = persistentAttributeInterceptable.$$_hibernate_getInterceptor();
|
||||
if ( persistentAttributeInterceptor != null
|
||||
&& !persistentAttributeInterceptor.getInitializedLazyAttributeNames().contains( fieldName ) ) {
|
||||
&& !persistentAttributeInterceptor.isAttributeLoaded( fieldName ) ) {
|
||||
return false;
|
||||
}
|
||||
return a == b;
|
||||
|
@ -85,7 +85,7 @@ public final class InlineDirtyCheckerEqualsHelper {
|
|||
int b) {
|
||||
final PersistentAttributeInterceptor persistentAttributeInterceptor = persistentAttributeInterceptable.$$_hibernate_getInterceptor();
|
||||
if ( persistentAttributeInterceptor != null
|
||||
&& !persistentAttributeInterceptor.getInitializedLazyAttributeNames().contains( fieldName ) ) {
|
||||
&& !persistentAttributeInterceptor.isAttributeLoaded( fieldName ) ) {
|
||||
return false;
|
||||
}
|
||||
return a == b;
|
||||
|
@ -98,7 +98,7 @@ public final class InlineDirtyCheckerEqualsHelper {
|
|||
long b) {
|
||||
final PersistentAttributeInterceptor persistentAttributeInterceptor = persistentAttributeInterceptable.$$_hibernate_getInterceptor();
|
||||
if ( persistentAttributeInterceptor != null
|
||||
&& !persistentAttributeInterceptor.getInitializedLazyAttributeNames().contains( fieldName ) ) {
|
||||
&& !persistentAttributeInterceptor.isAttributeLoaded( fieldName ) ) {
|
||||
return false;
|
||||
}
|
||||
return a == b;
|
||||
|
@ -111,7 +111,7 @@ public final class InlineDirtyCheckerEqualsHelper {
|
|||
float b) {
|
||||
final PersistentAttributeInterceptor persistentAttributeInterceptor = persistentAttributeInterceptable.$$_hibernate_getInterceptor();
|
||||
if ( persistentAttributeInterceptor != null
|
||||
&& !persistentAttributeInterceptor.getInitializedLazyAttributeNames().contains( fieldName ) ) {
|
||||
&& !persistentAttributeInterceptor.isAttributeLoaded( fieldName ) ) {
|
||||
return false;
|
||||
}
|
||||
return a == b;
|
||||
|
@ -124,7 +124,7 @@ public final class InlineDirtyCheckerEqualsHelper {
|
|||
double b) {
|
||||
final PersistentAttributeInterceptor persistentAttributeInterceptor = persistentAttributeInterceptable.$$_hibernate_getInterceptor();
|
||||
if ( persistentAttributeInterceptor != null
|
||||
&& !persistentAttributeInterceptor.getInitializedLazyAttributeNames().contains( fieldName ) ) {
|
||||
&& !persistentAttributeInterceptor.isAttributeLoaded( fieldName ) ) {
|
||||
return false;
|
||||
}
|
||||
return a == b;
|
||||
|
|
|
@ -36,6 +36,7 @@ public interface BytecodeLazyAttributeInterceptor extends SessionAssociableInter
|
|||
*/
|
||||
void attributeInitialized(String name);
|
||||
|
||||
@Override
|
||||
boolean isAttributeLoaded(String fieldName);
|
||||
|
||||
boolean hasAnyUninitializedAttributes();
|
||||
|
|
|
@ -78,4 +78,19 @@ public interface PersistentAttributeInterceptor extends InterceptorImplementor {
|
|||
@Deprecated
|
||||
default void attributeInitialized(String name) {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Callback from the enhanced class that an attribute has been loaded
|
||||
*
|
||||
* @deprecated Interceptors that deal with
|
||||
* * lazy state should implement {@link BytecodeLazyAttributeInterceptor}
|
||||
*
|
||||
* @param fieldName
|
||||
* @return true id the attribute is loaded false otherwise
|
||||
*/
|
||||
@Deprecated
|
||||
default boolean isAttributeLoaded(String fieldName){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue