JAVA
共 4 篇文章
Spring3.3 整合 Hibernate3、MyBatis3.2 配置多数据源/动态切换数据源 方法
Spring3.3 整合 Hibernate3、MyBatis3.2 配置多数据源/动态切换数据源 方法 一、开篇 这里整合分别采用了Hibernate和MyBatis两大持久层框架,Hibernate主要完成增删改功能和一些单一的对象查询功能,MyBatis主要负责查询功能。所以在出来数据库方言的时候基本上没有什么问题,但唯一可能出现问题的就是在hibernate做添加操作生成主键策略的时候。因为我们都知道hibernate的数据库本地方言会针对不同的数据库采用不同的主键生成策略。 所以针对这一问题不得不采用自定义的主键生成策略,自己写一个主键生成器的表来维护主键生成方式或以及使用其他的方…
2013-11-19 17:01 · JAVA
JSONP格式输出
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title> New Document </title> <meta name="Generator" content="EditPlus"/> <meta name="Author" content=""/> <meta name="Keywords" content=""/> <meta name="Description" content=""/> <s…
Spring3 异步调用机制@Async
测试方法 @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = { "classpath*:spring/application*.xml", "classpath*:test/*.xml" }) public class CodeTest { //异步调用方法 @Test public void testAsync() throws Exception { System.out.println("start"); roomService.asyncTest(); // ★ 假设这个方法会比较耗时,…
2013-02-06 14:45 · JAVA
POI模版导出excel
package com; import java.io.FileInputStream; import java.io.FileOutputStream; import java.util.ArrayList; import java.util.List; import org.apache.poi.hssf.usermodel.HSSFCell; import org.apache.poi.hssf.usermodel.HSSFCellStyle; import org.apache.poi.hssf.usermodel.HSSFRow; import org.apache.poi.hss…
2012-06-13 15:23 · JAVA