hibernate 报错: net.sf.hibernate.PropertyAccessException: exception setting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) setter of w15.Customer.setId
是one-to-many哪里出问题了? 有高手可否帮忙看一下?
public class PreparedStatementProxy implements InvocationHandler{ private PreparedStatemnet ps; public PreparedStatementProxy(Connection conn,String sql){ ps=conn.prepareStatement(sql); } public PreparedStatemnet prepareStatement(){ Class c=ps.getClass(); Class[] cls=c.getInterface(); if(cls.length==0){ } }}
不好意思,点错了 public class PreparedStatementProxy implements InvocationHandler{ private PreparedStatemnet ps; public PreparedStatementProxy(Connection conn,String sql){ ps=conn.prepareStatement(sql); } public PreparedStatemnet prepareStatement(){ Class c=ps.getClass(); Class[] cls=c.getInterface(); if(cls.length==0){ cls=new Class[]{PreparedStatemnet.class}; } return (PreparedStatement)Proxy.newProxyInstance(c.getClassLoader(),cls,this); } public Object invoke(Object proxy, Method method, Object[] args){ if(method.getName().starts("set")){ //调用了PreparedStatement的setX方法,在这里记载所有的修改 } return method.invoke(ps,args); } }//Connection conn=...; PreparedStatement ps=new PreparedStatement(conn,sql).prepareStatement(); 其它地方就不用修改了。
net.sf.hibernate.PropertyAccessException: exception setting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) setter of w15.Customer.setId
是one-to-many哪里出问题了? 有高手可否帮忙看一下?
private PreparedStatemnet ps;
public PreparedStatementProxy(Connection conn,String sql){
ps=conn.prepareStatement(sql);
} public PreparedStatemnet prepareStatement(){
Class c=ps.getClass();
Class[] cls=c.getInterface();
if(cls.length==0){ }
}}
public class PreparedStatementProxy implements InvocationHandler{
private PreparedStatemnet ps;
public PreparedStatementProxy(Connection conn,String sql){
ps=conn.prepareStatement(sql);
} public PreparedStatemnet prepareStatement(){
Class c=ps.getClass();
Class[] cls=c.getInterface();
if(cls.length==0){
cls=new Class[]{PreparedStatemnet.class};
}
return (PreparedStatement)Proxy.newProxyInstance(c.getClassLoader(),cls,this);
} public Object invoke(Object proxy, Method method, Object[] args){
if(method.getName().starts("set")){
//调用了PreparedStatement的setX方法,在这里记载所有的修改
}
return method.invoke(ps,args);
}
}//Connection conn=...;
PreparedStatement ps=new PreparedStatement(conn,sql).prepareStatement();
其它地方就不用修改了。