09 2013 档案
java注释
摘要:myAnnotation package com.wzh.test; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; 阅读全文
posted @ 2013-09-29 23:07 上校 阅读(174) 评论(0) 推荐(0) 编辑
java反射1
摘要:ClassLoader cl = ClassLoader.getSystemClassLoader(); Class c = cl.loadClass("com.wzh.test.Student"); System.out.println(c); System.out.println(c.getName()); 阅读全文
posted @ 2013-09-28 22:21 上校 阅读(222) 评论(0) 推荐(0) 编辑
java反射生成ORM
摘要:package com.wzh.jdbc; import java.lang.reflect.Field; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.SQLException; 阅读全文
posted @ 2013-09-27 20:48 上校 阅读(564) 评论(0) 推荐(0) 编辑
java回调函数
摘要:protected interface Callback { E doInCallback(Connection conn, PreparedStatement pstm, ResultSet rs) throws Throwable; } 阅读全文
posted @ 2013-09-26 22:34 上校 阅读(302) 评论(0) 推荐(0) 编辑
JDBC常用代码
摘要:try { //加载驱动 Class.forName("com.mysql.jdbc.Driver"); String url="jdbc:mysql://127.0.0.1:3306/test"; //通过DriverManager获取连接 Connection conn=DriverManager.getConnection(url,"root","hello"); System.out.println("conn:"+conn); //准备操作数据库 //Statement:用于执行静态SQL语句并返回它所生产结果的对象 Statement stm=conn.createStatement(); String sql="insert into test.new_table(t1,t2) values('t11','t22');"; Boolean ret =stm.execute(sql); conn.close(); } catch (Exception e) { // TODO: handle exception e.printStackTrac 阅读全文
posted @ 2013-09-19 11:32 上校 阅读(4989) 评论(0) 推荐(1) 编辑
mysql特有语法
摘要:1.插入多条记录 insert into test.new_table(t1) values('1'), ('2'); 2.复制表结构及数据 create table test.tb2 SELECT * FROM test.new_table; 3.连接字符串函数 select concat(t1,t2) from test.new_table create table test.tb2 SELECT * FROM test.new_table; 阅读全文
posted @ 2013-09-17 22:45 上校 阅读(443) 评论(0) 推荐(0) 编辑
dom4j-full.jar 解析 XML
摘要:dom4j-full.jar 解析 XML public Document getDocument() throws DocumentException { SAXReader read=new SAXReader(); return read.read(this.getClass().getResourceAsStream("/course.xml")); } 阅读全文
posted @ 2013-09-07 00:39 上校 阅读(1646) 评论(0) 推荐(0) 编辑


点击右上角即可分享
微信分享提示