Java
文章平均质量分 72
harveyzeng
这个作者很懒,什么都没留下…
展开
-
Spring 定时任务及cron表达式
work.scheduling.annotation.EnableScheduling;import org.springframework.stereotype.Component;@Component@EnableSchedulingpublic class ScheduleTest { @Scheduled(cron = "0 0 3 * * ?") public void demoSchedule() { Sys原创 2017-03-16 10:22:10 · 230 阅读 · 0 评论 -
Hibernate错误:org.hibernate.LazyInitializationException: illegal access to loading
org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:86) 原因在于pojo里面的 public int hashCode() {... } 方法调用了set对象成员的hashCode()方法 如this.getSets().hashCode(); 删除该方法的调用即可;调用非set对象成员的.hashCode()方法没有问题。原创 2013-09-16 19:16:06 · 137 阅读 · 0 评论 -
Axis2开发WebService客户端 的3种方式
import javax.xml.namespace.QName; import org.apache.axiom.om.OMAbstractFactory; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMNamespace; import org.apache.axis2.AxisFaul原创 2013-04-18 18:05:13 · 330 阅读 · 0 评论 -
freemarker用字符串构建模版
ache.TemplateLoader;import freemarker.template.Configuration;import freemarker.template.Template;public class StringTemplateLoader implements TemplateLoader { private String template; public StringTemplateLoader(String template) { this.t原创 2013-04-15 16:14:43 · 90 阅读 · 0 评论 -
Java基本类型、包装类以及自定义类判断
ng.class)); System.out.println(isWrapClass(Integer.class)); System.out.println(isWrapClass(String.class)); System.out.println(isWrapClass(Test.class)); } public static boolean isWrapClass(Class clz) {原创 2013-02-18 17:48:21 · 851 阅读 · 0 评论 -
正则表达式匹配域名、网址、url
原创 2013-01-28 18:02:34 · 515 阅读 · 0 评论 -
正则表达式基础之——环视 [转]
原创 2013-01-25 09:35:10 · 83 阅读 · 0 评论 -
通过反射实现map和bean之间的转换
{ // TODO Auto-generated method stub OrgResponse resp = new OrgResponse(); resp.setAccountNumber("12346"); resp.setCustomerID("5566"); resp.setPassword("hello1sa");// Map<String, Object> re原创 2012-12-21 09:25:43 · 104 阅读 · 0 评论 -
遍历集合时出现的异常Exception in thread "main" java.util.ConcurrentModificationException
if (str.equals("-")){ list.remove(str); } } }因为list在循环中的时候是不可以删除它的元素的这样写就没有问题for (Iterator it = list.iterator(); it.hasNext();) { String str = (String)it.next(); if (str.原创 2012-08-29 18:11:50 · 188 阅读 · 0 评论 -
Java List集合冒泡法排序的两种实现
列的工作是重复地进行直到没有再需要交换,也就是说该数列已经排序完成。这个算法的名字由来是因为越小的元素会经由交换慢慢“浮”到数列的顶端。 冒泡排序算法的运作如下: 比较相邻的元素。如果第一个比第二个大,就交换他们两个。 对每一对相邻元素作同样的工作,从开始第一对到结尾的最后一对。在这一点,最后的元素应该会是最大的数。 针对所有的元素重复以上的步骤,除了最后一个。 持续每次对越来越少的元素重复上面的步骤,直到没有任何一对数字需要比较。 方法一:1. 如果集合的值为int类原创 2012-08-29 18:09:20 · 336 阅读 · 0 评论 -
sybase存储过程及Java调用
rchar(30)) as begin update user_tab set delete_id=1000 where user_name=@y and delete_datetime is not null endgo调用:exec test_sp_1 'hello'2,有返回参数create procedure test2(@a int,@b int,@c int output,@d int output)asbegin select @c=@a+@b select @d=@a*@b原创 2012-08-24 09:47:59 · 107 阅读 · 0 评论 -
Java动态执行代码Bsh
bsh.EvalError;import bsh.Interpreter;public class Test { public static void main(String[] args) { Interpreter interpreter = new Interpreter(); String s = "2>3||3>4&&5<4"; try { interpreter原创 2014-02-28 17:42:52 · 507 阅读 · 0 评论 -
Java面试问题
原创 2014-04-17 17:37:04 · 52 阅读 · 0 评论 -
mybatis-generator生成mapper等对象
rg.mybatis.generator</groupId> <artifactId>mybatis-generator-core</artifactId> <version>1.3.5</version> </dependency> 一次性生成多张表的映射:原创 2017-03-15 15:34:55 · 85 阅读 · 0 评论 -
Java解决Emoji表情符问题
SQL []; SQL state [HY000]; error code [1366]; Incorrect string value: '\xF0\x9F\x8F\x80 $...' for column 'content' 发现是Emoji表情符编码保存问题。 解决方案:1. 数据存储(MySQL varchar 数据类型对UTF8 支持问题) MYSQL 5.5 之前, UTF8 编码只支持1-3个字节, 从MYSQL5.5开始,可支持4个字节UTF编码,但要特殊原创 2016-01-28 17:29:19 · 838 阅读 · 0 评论 -
mybatis 模糊查询%问题
batis防止sql注入 http://blog.sina.com.cn/s/blog_8e5354210101ezfm.htmlhttp://my.oschina.net/ydsakyclguozi/blog/266863 ----------------------------其它知识点 end----------------------------- 网上找的例子大部分说:对于MySQL可以通过CONCAT('%',#{param}#,'%')进行模糊查询但是引入了另一原创 2015-09-28 18:52:44 · 159 阅读 · 0 评论 -
常见异常备忘
xpected content storage modification参考: http://blog.csdn.net/phantomes/article/details/42002495 3. Mybatis的if test字符串比较问题<if test="isExpired=='Y'">and msg.expire_time &lt; now()</if>会报NumberFormatEx原创 2015-09-23 17:59:35 · 95 阅读 · 0 评论 -
省市区三级联动实现
91?p=2#comments演示:http://selectpcd.oschina.mopaas.com/jsp+jquery实现省市区三级联动下拉 http://blog.csdn.net/kalision/article/details/39229953 亲测通过:1. jsp结合jquery实现省市区三级联动下拉附件:下载说明:在作者基础上加入台湾、香港和澳门数据 2. JS 实现联动(QQ)附件:下载 3. jquery联动(还有数据库、PHP示例原创 2015-06-02 18:11:00 · 278 阅读 · 0 评论 -
面试题记录4
原创 2015-03-10 18:19:21 · 52 阅读 · 0 评论 -
理解Java移位操作
原创 2014-11-06 12:26:57 · 78 阅读 · 0 评论 -
一个排好序的数组,找出两数之和为m的所有组合
原创 2014-09-25 16:20:46 · 206 阅读 · 0 评论 -
Java String知识点
原创 2014-09-19 11:01:20 · 60 阅读 · 0 评论 -
用JAVA导出CSV
public static File createCSVFile(List<Map<String, String>> exportData, LinkedHashMap<String, String> titleMap, String outPutPath) { File csvFile = null; BufferedWriter csvFileOutputStream = null原创 2014-07-08 14:00:01 · 73 阅读 · 0 评论 -
用JDBC取到数据库表之间的主外键关系
oreigntablename = rs.getString(7);//从 1到16 依次试试,就知道各个的含义了,另外也可以自己直接查api,看是什么... 7是外键的表名,其他有字段名等等DatabaseMetaData的 getExportedKeys(String catalog, String schema, String table) Retrieves a description原创 2012-07-19 15:24:24 · 211 阅读 · 0 评论 -
jdbc一个connection 下的事务问题[转]
置回滚点 stmt = conn.createStatement(); stmt.executeUpdate("alter table …"); //数据库更新操作1 stmt.executeUpdate("insert into table …"); //数据库更新操作2 conn.commit(); //事务提交}catch(Exception ex) { ex.printStackTrace(); try { conn.原创 2012-06-13 12:14:13 · 111 阅读 · 0 评论 -
[转载]Dbutil 的使用
原创 2012-02-20 15:53:57 · 47 阅读 · 0 评论 -
[转载]httpclient 自己管理cookie
IES);二、在某个请求获得cookie时获取cookie: private static List<String> cookieList=new ArrayList<String>(); if (theget.getResponseHeader("Set-Cookie") != null) { cookieList.clear();原创 2012-02-17 14:41:40 · 89 阅读 · 0 评论 -
java分组 -- 将相同的数据分为一组
: import java.util.ArrayList;import java.util.HashMap;import java.util.List;import java.util.Map;import java.util.Map.Entry;class Group { private List<Integer> ins = new ArrayList<Integer>(); public List<Integer&a原创 2012-02-09 10:29:43 · 1534 阅读 · 0 评论 -
arrayList vector linkedList 区别与用法
原创 2012-01-11 22:33:04 · 54 阅读 · 0 评论 -
Java中==和equals的区别(1)
“==”比较两个变量本身的值,即两个对象在内存中的首地址。“equals()”比较字符串中所包含的内容是否相同。比如:String s1,s2,s3 = "abc", s4 ="abc" ;s1 = new String("abc");s2 = new String("abc");那么:s1==s2 是 false //两个变量的内存地址不一样,也就是说它们指向的对象不 一样,故不相等。原创 2012-01-04 20:40:40 · 84 阅读 · 0 评论 -
Java为什么支持反射机制?
原创 2011-12-28 09:42:03 · 136 阅读 · 0 评论 -
Java中==和equals的区别(2)
原创 2011-12-28 09:39:34 · 54 阅读 · 0 评论 -
什么是反射机制?
原创 2011-12-28 09:36:24 · 73 阅读 · 0 评论 -
对象的序列化和反序列化
原创 2011-12-28 09:32:50 · 41 阅读 · 0 评论 -
理解Java多态性
原创 2011-12-28 09:29:47 · 56 阅读 · 0 评论 -
[转载]Dbutil 的使用示例
import java.sql.SQLException; import java.util.List; import java.util.Map; import org.apache.commons.dbutils.DbUtils; import org.apache.commons.dbutils.QueryRunner; import org.apache.commons.dbutils.handlers.ArrayHan原创 2012-02-20 15:57:39 · 66 阅读 · 0 评论 -
Quartz 入门
原创 2012-02-20 16:12:29 · 46 阅读 · 0 评论 -
Eclipse RCP 学习
clipse插件开发彻底攻略:http://www.cnblogs.com/liuzhuo/category/257208.html Eclipse Plugin 在 Console上打印出message:http://blog.csdn.net/rujielaisusan/article/details/4505188 开发您的第一个 Eclipse RCP 应用程序:http://www.ibm.com/developerworks/cn/education/opensou原创 2012-05-21 22:25:18 · 61 阅读 · 0 评论 -
eclipse提高效率的插件
原创 2012-04-12 17:59:03 · 83 阅读 · 0 评论 -
myeclipse 注册码生成(Java)
this copyrighted software is a violation of both your license agreement and the Digital Millenium Copyright Act of 1998 (http://www.loc.gov/copyright/legislation/dmca.pdf). Under section 1204 of the DMCA, penalties range up to a $500,000 fine or up to fiv原创 2012-03-29 17:16:01 · 58 阅读 · 0 评论