JAVA 诠注(Annotation) ,模拟自动创建表
JAVA 注解(Annotation) ,模拟自动创建表/**??*?执行SQL??*?@param?sql??*/??public?static?void?executeSq
JAVA 注解(Annotation) ,模拟自动创建表
- /**?
- ?*?执行SQL?
- ?*?@param?sql?
- ?*/??
- public?static?void?executeSql(String?sql){??
- ????conn?=?ConnectionUtil.getConnection();??
- ????try?{??
- ????????PreparedStatement?ps?=?conn.prepareStatement(sql);??
- ????????ps.execute();??
- ????}?catch?(SQLException?e)?{??
- ????????e.printStackTrace();??
- ????}finally{??
- ????????ConnectionUtil.colse(conn);??
- ????}??
- }??
- ??
- public?static?void?main(String[]?args)?{??
- ????String?sql?=?CrateTable.getCreateSQL("com.annotation.TestTable");??
- ????System.out.println(sql);??
- ????executeSql(sql);??
- ??????
- } ?