Skip to content

Commit cd574a3

Browse files
scottmarlowmbellade
authored andcommitted
HHH-19529 Check bytecode generated classes with stable names class loaders to ensure EE subdeployment contained entity classes are used in preference to top level deployment (e.g. EAR/lib)
Signed-off-by: Scott Marlow <[email protected]>
1 parent 199269a commit cd574a3

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

hibernate-core/src/main/java/org/hibernate/bytecode/internal/bytebuddy/ByteBuddyState.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,10 @@ void clearState() {
214214
*/
215215
public Class<?> load(Class<?> referenceClass, String className, BiFunction<ByteBuddy, NamingStrategy, DynamicType.Builder<?>> makeClassFunction) {
216216
try {
217-
return referenceClass.getClassLoader().loadClass( className );
217+
Class<?> result = referenceClass.getClassLoader().loadClass(className);
218+
if ( result.getClassLoader() == referenceClass.getClassLoader() ) {
219+
return result;
220+
}
218221
}
219222
catch (ClassNotFoundException e) {
220223
// Ignore

0 commit comments

Comments
 (0)