摘要: SSH hibernate 使用时最好添加访问数据库的编码如下所示:第13行为设置hibernate访问数据库的编码(&是&的转义序列) 1 4 5 6 7 8 9 10 com.mysql.jdbc.Driver11 12 13 jdbc:mysql://localhost:3306/hibernatetest?useUnicode=true&characterEncoding=UTF-814 15 root16 ... 阅读全文
posted @ 2013-08-06 21:58 无忧之路 阅读(271) 评论(0) 推荐(0) 编辑
摘要: Hibernate关于sql中的count(*)数据统计:①如果使用的是HQL:直接在HQL中使用count(*)即可获取行数 Long count = (Long)HibernateUtil.getSession() .createQuery("select count(*) from Employee") .uniqueResult(); System.out.println(count); ②如果使用的是Criteria方式查询:使用Projections.rowCount()方法 ... 阅读全文
posted @ 2013-08-06 21:22 无忧之路 阅读(1006) 评论(0) 推荐(0) 编辑
摘要: JDK5以后Integer a = 3; 这是自动装箱int i = new Integer(2); 这是自动拆箱就是基本类型和其对应的包装类型在需要的时候可以互相转换,具体过程由编译器完成比如自动装箱:Integer a=3;其实编译器调用的是static Integer valueOf(int i)这个方法查阅JDK知道,valueOf(int i)返回一个表示指定的int 值的Integer 对象那么就变成这样: Integer a=3; => Integer a=Integer.valueOf(3);对应的 int intValue() 返回该Integer对象的int值,是拆箱 阅读全文
posted @ 2013-08-06 00:20 无忧之路 阅读(296) 评论(0) 推荐(0) 编辑
无忧之路