diff --git a/src/main/java/com/loafle/overflow/proxy/db/DBProxy.java b/src/main/java/com/loafle/overflow/proxy/db/DBProxy.java index 0214881..75d1b22 100644 --- a/src/main/java/com/loafle/overflow/proxy/db/DBProxy.java +++ b/src/main/java/com/loafle/overflow/proxy/db/DBProxy.java @@ -137,7 +137,7 @@ public class DBProxy { if(params.size() > 0) { // method = dao.getClass().getMethod(methodName, Object.class); - method = MethodSeeker.getMethod(dao.getClass(), methodName); + method = MethodSeeker.getMethod(dao.getClass(), methodName, paramTypes); if (method == null) { throw new Exception("Not found method : " + methodName); } diff --git a/src/main/java/com/loafle/overflow/proxy/db/MethodSeeker.java b/src/main/java/com/loafle/overflow/proxy/db/MethodSeeker.java index 0552514..6227834 100644 --- a/src/main/java/com/loafle/overflow/proxy/db/MethodSeeker.java +++ b/src/main/java/com/loafle/overflow/proxy/db/MethodSeeker.java @@ -21,10 +21,19 @@ public class MethodSeeker { } - public static Method getMethod(Class cls, String methodName) { + public static Method getMethod(Class cls, String methodName, List paramTypes) { Method method = null; + if(paramTypes != null) { + method = MethodSeeker.getMethodType(cls, methodName, paramTypes.toArray(new Class[paramTypes.size()])); + } + + if(method != null) { + return method; + } + + for(Class type : MethodSeeker.typeList) { method = MethodSeeker.getMethodType(cls,methodName, type); if(method != null) { @@ -36,7 +45,7 @@ public class MethodSeeker { } - private static Method getMethodType(Class jpa, String methodName, Class type) { + private static Method getMethodType(Class jpa, String methodName, Class ...type) { if (jpa == null) { return null; }