02 2021 档案
摘要:public class splitTest { public static void main(String[] args) { String a = "@123"; String b = "123@"; String c = "3@@@"; String[] aArr = a.split("@"
阅读全文
摘要:伍:主要是要加上转义字符 1、split方法转化字符串为数组: String[] strPicArr = map.get("hw_pic").toString().split("*"); 报错: java.util.regex.PatternSyntaxException: Dangling met
阅读全文
摘要:需求:只要名字相同,就判断是同一个用户 1、重写equals方法 public static class Student{ private String name; private int age; // @Override // public int hashCode(){ // final in
阅读全文
摘要:解决办法: 导致这个问题的原因是插入的分页符或者空白页,并且在空白页或者分页符前面没有空白行,多按几次回车将分页符或者空白页符向后推移一点,留出空白行,这里样就正常了
阅读全文
摘要:String splitStr = Pattern.compile("[^0-9]").matcher(currentName).replaceAll(""); 通过这个操作来截取数字
阅读全文
摘要:注意:1、后面用uniqueResult() 2、返回的是Long而不是Integer
阅读全文
摘要:通过BoderLayout.crateEmptyBorder()可以设置
阅读全文
摘要:Swing工程中JTable清空 1、 // DefaultTableModel model = (DefaultTableModel) table.getModel();// for (int i = model.getRowCount() - 1; i >= 0; i--) {// model.
阅读全文
摘要:主因 : 事务对程序的影响 原因一: 查询出来的对象和update的对象不是同一个 解决: 用查询出的对象进行set 值, 再用同一个对象update 原因二: 查询出来的对象在缓存中一段时间 , 之后再进行的update 解决: 把这个对象从缓存中剔除(如需要对象属性可先get保存到变量中) ,
阅读全文
摘要:如果你传入TableModel的值为null,你通过这一步 tableModel.getValueAt(row, 0); 取得的值也是为null。 如果传入的为"",则取得的值也是这个
阅读全文
摘要:1、看了网上很多关于这个的解释,说悲观锁、乐观锁。还有什么数据库版本问题 后来发现不是这么回事,直接你传的对象住建ID不为null,但数据库中又没有这个对应ID的值,就会报这个错误 解决方法:把主键ID改为正确值的值就可以了。
阅读全文
摘要:就算在catch中抛出异常,也会执行到finally中
阅读全文
摘要:1、问题:如何在spring和hibernate整合中,有个特殊需要,就是不用spring的AOP来切入事务,而是手动写事务。 这个时候如果用getCurrentSession,就会报“Could not obtain transaction-synchronized Session for cur
阅读全文
摘要:1、openSession必须关闭,currentSession在事务结束后自动关闭 2、openSession没有和当前线程绑定,currentSession和当前线程绑定
阅读全文
摘要:能创建对象,只是这个类不能继承并且别的类不能访问
阅读全文
摘要:在spring配置中,加入下面一个配置 <aop:aspectj-autoproxy proxy-target-class="true"/>
阅读全文
摘要:在eclipse中,使用svn从恢复到某个版本的时候会报错: org.apache.subversion.javahl.ClientException: Working copy and merge source not ready for reintegrationsvn: Cannot reve
阅读全文
摘要:public class StringIndexOfTest { public static void main(String[] args) { String a = "10"; String b = "A10"; String c = "10A"; int index = a.indexOf("
阅读全文
摘要:一、设置Eclipse关联JDK源码 1.打开Eclipse——>Windows——>Preferences 2. 在弹出的Preferences对话框中,Java——>Installed JRES——>选中jre(根据自己的安装确定)——>Edit 3. 在弹出的 Edit JRE对话框中,选中你
阅读全文
摘要:public class MutilHeadTable extends JTable { public MutilHeadTable(TableModel tm) { super(tm); init(); } private void init(){ //为每个列添加自定义的RENDER.这个Api
阅读全文