-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HHH-15634 Lazy basic property does not get updated on change: inline …
…dirty checking, lazy basic properties are not upated when set to null
- Loading branch information
Showing
2 changed files
with
210 additions
and
23 deletions.
There are no files selected for viewing
132 changes: 132 additions & 0 deletions
132
...ava/org/hibernate/bytecode/enhance/internal/bytebuddy/InlineDirtyCheckerEqualsHelper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
/* | ||
* Hibernate, Relational Persistence for Idiomatic Java | ||
* | ||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later. | ||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>. | ||
*/ | ||
package org.hibernate.bytecode.enhance.internal.bytebuddy; | ||
|
||
import java.util.Objects; | ||
|
||
import org.hibernate.engine.spi.PersistentAttributeInterceptable; | ||
import org.hibernate.engine.spi.PersistentAttributeInterceptor; | ||
|
||
public final class InlineDirtyCheckerEqualsHelper { | ||
|
||
public static boolean areEquals( | ||
PersistentAttributeInterceptable persistentAttributeInterceptable, | ||
String fieldName, | ||
Object a, | ||
Object b) { | ||
final PersistentAttributeInterceptor persistentAttributeInterceptor = persistentAttributeInterceptable.$$_hibernate_getInterceptor(); | ||
if ( persistentAttributeInterceptor != null | ||
&& !persistentAttributeInterceptor.getInitializedLazyAttributeNames().contains( fieldName ) ) { | ||
return false; | ||
} | ||
return Objects.deepEquals( a, b ); | ||
} | ||
|
||
public static boolean areEquals( | ||
PersistentAttributeInterceptable persistentAttributeInterceptable, | ||
String fieldName, | ||
boolean a, | ||
boolean b) { | ||
final PersistentAttributeInterceptor persistentAttributeInterceptor = persistentAttributeInterceptable.$$_hibernate_getInterceptor(); | ||
if ( persistentAttributeInterceptor != null | ||
&& !persistentAttributeInterceptor.getInitializedLazyAttributeNames().contains( fieldName ) ) { | ||
return false; | ||
} | ||
return a == b; | ||
} | ||
|
||
public static boolean areEquals( | ||
PersistentAttributeInterceptable persistentAttributeInterceptable, | ||
String fieldName, | ||
byte a, | ||
byte b) { | ||
final PersistentAttributeInterceptor persistentAttributeInterceptor = persistentAttributeInterceptable.$$_hibernate_getInterceptor(); | ||
if ( persistentAttributeInterceptor != null | ||
&& !persistentAttributeInterceptor.getInitializedLazyAttributeNames().contains( fieldName ) ) { | ||
return false; | ||
} | ||
return a == b; | ||
} | ||
|
||
public static boolean areEquals( | ||
PersistentAttributeInterceptable persistentAttributeInterceptable, | ||
String fieldName, | ||
short a, | ||
short b) { | ||
final PersistentAttributeInterceptor persistentAttributeInterceptor = persistentAttributeInterceptable.$$_hibernate_getInterceptor(); | ||
if ( persistentAttributeInterceptor != null | ||
&& !persistentAttributeInterceptor.getInitializedLazyAttributeNames().contains( fieldName ) ) { | ||
return false; | ||
} | ||
return a == b; | ||
} | ||
|
||
public static boolean areEquals( | ||
PersistentAttributeInterceptable persistentAttributeInterceptable, | ||
String fieldName, | ||
char a, | ||
char b) { | ||
final PersistentAttributeInterceptor persistentAttributeInterceptor = persistentAttributeInterceptable.$$_hibernate_getInterceptor(); | ||
if ( persistentAttributeInterceptor != null | ||
&& !persistentAttributeInterceptor.getInitializedLazyAttributeNames().contains( fieldName ) ) { | ||
return false; | ||
} | ||
return a == b; | ||
} | ||
|
||
public static boolean areEquals( | ||
PersistentAttributeInterceptable persistentAttributeInterceptable, | ||
String fieldName, | ||
int a, | ||
int b) { | ||
final PersistentAttributeInterceptor persistentAttributeInterceptor = persistentAttributeInterceptable.$$_hibernate_getInterceptor(); | ||
if ( persistentAttributeInterceptor != null | ||
&& !persistentAttributeInterceptor.getInitializedLazyAttributeNames().contains( fieldName ) ) { | ||
return false; | ||
} | ||
return a == b; | ||
} | ||
|
||
public static boolean areEquals( | ||
PersistentAttributeInterceptable persistentAttributeInterceptable, | ||
String fieldName, | ||
long a, | ||
long b) { | ||
final PersistentAttributeInterceptor persistentAttributeInterceptor = persistentAttributeInterceptable.$$_hibernate_getInterceptor(); | ||
if ( persistentAttributeInterceptor != null | ||
&& !persistentAttributeInterceptor.getInitializedLazyAttributeNames().contains( fieldName ) ) { | ||
return false; | ||
} | ||
return a == b; | ||
} | ||
|
||
public static boolean areEquals( | ||
PersistentAttributeInterceptable persistentAttributeInterceptable, | ||
String fieldName, | ||
float a, | ||
float b) { | ||
final PersistentAttributeInterceptor persistentAttributeInterceptor = persistentAttributeInterceptable.$$_hibernate_getInterceptor(); | ||
if ( persistentAttributeInterceptor != null | ||
&& !persistentAttributeInterceptor.getInitializedLazyAttributeNames().contains( fieldName ) ) { | ||
return false; | ||
} | ||
return a == b; | ||
} | ||
|
||
public static boolean areEquals( | ||
PersistentAttributeInterceptable persistentAttributeInterceptable, | ||
String fieldName, | ||
double a, | ||
double b) { | ||
final PersistentAttributeInterceptor persistentAttributeInterceptor = persistentAttributeInterceptable.$$_hibernate_getInterceptor(); | ||
if ( persistentAttributeInterceptor != null | ||
&& !persistentAttributeInterceptor.getInitializedLazyAttributeNames().contains( fieldName ) ) { | ||
return false; | ||
} | ||
return a == b; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters