1.0.0-SNAPSHOT
This commit is contained in:
parent
c1a1c8f523
commit
f60517bbe9
|
@ -93,6 +93,15 @@ public class DBProxy {
|
||||||
|
|
||||||
ObjectMapper mapper = new ObjectMapper();
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
|
|
||||||
|
Object retObj = null;
|
||||||
|
Method method = null;
|
||||||
|
|
||||||
|
if (methodName.equals("find")) {
|
||||||
|
method = dao.getClass().getSuperclass().getMethod(methodName, String.class);
|
||||||
|
retObj = method.invoke(dao, params.get("id"));
|
||||||
|
return mapper.writeValueAsString(retObj);
|
||||||
|
}
|
||||||
|
|
||||||
List<Class> paramTypes = new ArrayList<Class>();
|
List<Class> paramTypes = new ArrayList<Class>();
|
||||||
List<Object> valueList = new ArrayList<Object>();
|
List<Object> valueList = new ArrayList<Object>();
|
||||||
for( String className : params.keySet() ){
|
for( String className : params.keySet() ){
|
||||||
|
@ -103,15 +112,11 @@ public class DBProxy {
|
||||||
paramTypes.add(cls);
|
paramTypes.add(cls);
|
||||||
}
|
}
|
||||||
|
|
||||||
Object retObj = null;
|
|
||||||
Method method = null;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
//Check if it belongs to the JPABaseDAO.
|
//Check if it belongs to the JPABaseDAO.
|
||||||
method = dao.getClass().getSuperclass().getMethod(methodName, Object.class);
|
method = dao.getClass().getSuperclass().getMethod(methodName, Object.class);
|
||||||
if(method != null) {
|
retObj = method.invoke(dao, valueList.toArray(new Object[valueList.size()]));
|
||||||
retObj = method.invoke(dao, valueList.toArray(new Object[valueList.size()]));
|
|
||||||
}
|
|
||||||
}catch(NoSuchMethodException e) {
|
}catch(NoSuchMethodException e) {
|
||||||
if(params.size() > 0) {
|
if(params.size() > 0) {
|
||||||
method = dao.getClass().getMethod(methodName, paramTypes.toArray(new Class[paramTypes.size()]));
|
method = dao.getClass().getMethod(methodName, paramTypes.toArray(new Class[paramTypes.size()]));
|
||||||
|
|
|
@ -9,8 +9,8 @@
|
||||||
<property name="javax.persistence.jdbc.driver" value="org.postgresql.Driver" />
|
<property name="javax.persistence.jdbc.driver" value="org.postgresql.Driver" />
|
||||||
<property name="javax.persistence.jdbc.user" value="vertx" />
|
<property name="javax.persistence.jdbc.user" value="vertx" />
|
||||||
<property name="javax.persistence.jdbc.password" value="qwe123" />
|
<property name="javax.persistence.jdbc.password" value="qwe123" />
|
||||||
<!--<property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect" />-->
|
<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect" />
|
||||||
<property name="hibernate.hbm2ddl.auto" value="create"/>
|
<!--<property name="hibernate.hbm2ddl.auto" value="create"/>-->
|
||||||
<property name="hibernate.show_sql" value="true" />
|
<property name="hibernate.show_sql" value="true" />
|
||||||
</properties>
|
</properties>
|
||||||
</persistence-unit>
|
</persistence-unit>
|
||||||
|
|
|
@ -37,7 +37,8 @@ public class TestClient {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Member m = new Member();
|
Member m = new Member();
|
||||||
m.setName("insanity2222");
|
m.setId(Long.parseLong("2"));
|
||||||
|
m.setName("geek");
|
||||||
m.setCompany("loafle");
|
m.setCompany("loafle");
|
||||||
m.setDigest("bbbbbbbbb");
|
m.setDigest("bbbbbbbbb");
|
||||||
m.setPwSalt("salktttt");
|
m.setPwSalt("salktttt");
|
||||||
|
@ -47,9 +48,9 @@ public class TestClient {
|
||||||
|
|
||||||
DBInput request = DBInput.newBuilder()
|
DBInput request = DBInput.newBuilder()
|
||||||
.setTargetDao("member")
|
.setTargetDao("member")
|
||||||
.setMethod("create")
|
.setMethod("findByEmail")
|
||||||
.putParams("com.loafle.overflow.member.model.Member", mapper.writeValueAsString(m))
|
.putParams("com.loafle.overflow.member.model.Member", mapper.writeValueAsString(m))
|
||||||
//.putParams("com.loafle.overflow.member.Member2", mapper.writeValueAsString(m2))
|
//.putParams("id", "1")
|
||||||
.build();
|
.build();
|
||||||
DBOutput response;
|
DBOutput response;
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user