Last active
March 22, 2024 19:05
-
-
Save tomatophobia/9a3bea1b37c3c83c9897d68bdc51adae to your computer and use it in GitHub Desktop.
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
public static void validateProxyability(PersistentClass persistentClass) { | |
Iterator properties = persistentClass.getPropertyIterator(); | |
Class clazz = persistentClass.getMappedClass(); | |
while(properties.hasNext()) { | |
Property property = (Property)properties.next(); | |
validateGetterSetterMethodProxyability("Getter", property.getGetter(clazz).getMethod()); | |
validateGetterSetterMethodProxyability("Setter", property.getSetter(clazz).getMethod()); | |
} | |
} | |
public static void validateGetterSetterMethodProxyability(String getterOrSetter, Method method) { | |
// getter/setter 존재하는데 final인지 확인 | |
if (method != null && Modifier.isFinal(method.getModifiers())) { | |
throw new HibernateException(String.format("%s methods of lazy classes cannot be final: %s#%s", getterOrSetter, method.getDeclaringClass().getName(), method.getName())); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment