利用BeanUtils.copyProperties 克隆出新对象,避免对象重复问题

1、经常用jQuery获取标签里面值val(),或者html(),text()等等,有次想把获取标签的全部html元素包括自己也用来操作,查询了半天发现$("#lefttr1").prop("outerHTML")即可。

2、当时遇到这个错误,后发现是缺少主键错误。

 

3、JsonMappingException: No suitable constructor found ,reate the default constructor for your POJO class

这两种报错都有可能是没有创建构造函数原因。

4、java.lang.OutOfMemoryError: PermGen spac内存不足通过百度内存不足解决

5、could not load an entity有可能是数据库和实体对应的字段不一致

6、今天遇到File.separator 不明白什么意思,一查得知是系统有关的分隔符,'/'相关详情为http://blog.csdn.net/chindroid/article/details/7735832其中包含其他系统有关字段。

7、

ObjectMapper obj= new ObjectMapper();

jsonString=obj.writeValueAsString(customerAuthWithCustomerReq); 这样可以把集合列表转换成json。

8、iframe页面中parent.funA可以调用父页面方法。

9、BeanUtils.copyProperties(productInstQueryForm, req);可以复制一个类到另一个类,减少各种set,,这个问题遇到多次了,

public static void main(String[] args) {
            List<AccAccountBalanceInterest> newAccAccountBalanceInterestList = new ArrayList<AccAccountBalanceInterest>();
            AccAccountBalanceInterest bbb=new AccAccountBalanceInterest(); 
            bbb.setId("111");
            bbb.setInterestAmount(new BigDecimal("0"));
            for(int i=0;i<3;i++){
                AccAccountBalanceInterest aaa=new AccAccountBalanceInterest();
                aaa=bbb;
                aaa.setInterestAmount(new BigDecimal(i));
                newAccAccountBalanceInterestList.add(aaa);
            }
            for(int i=0;i<3;i++){
                System.out.println(newAccAccountBalanceInterestList.get(i).getInterestAmount());
            }

list循环发现 都是同一个对象。最后用BeanUtils.copyProperties解决

 10、开发中,当想删除数据库后再新增的时候,需要考虑下删除的时候,同时其他是否有操作。对该功能的影响

11、windows软连接功能。记录一下

12、grep -n "DC864180719A31700219" catalina.out  直接查日志中包含该字段。

13、  list或者map转换成json的时候,空值的时候,字段会变没有,展现出来的是未定义 解决办法JSONObject jsonObject = JSONObject.fromObject(map);

14、history | grep aa  这种指令。可以查看历史指令包含aa的。。有时候linux中不知道某个服务怎么启动。可以这样看

15、windows下看ip中端口是否能访问。telnet ip port

16、c:forEach的值传到java里

 

posted on 2016-04-08 18:04  孤王就是朕  阅读(868)  评论(0编辑  收藏  举报