- 浏览: 36672 次
- 性别:
- 来自: 成都
-
最新评论
-
lkl:
很好的一篇文章
hibernate 和 spring 整合的事物管理
文章列表
在hibernate和spring时总结的一些知识,以供将来查询和使用。
spring针对hibernate的整合做了许多的努力,当我们使用spring时,对hibernate的使用变得更加简单。
hibernate通过sessionFactory创建session,spring对hibernate进行了无缝的整合,无需自己写代码实现通过Configuration.buildSessionFactory()来创建一个SessionFactory.较为流行的做法是在applicationContext中注册工厂bean为一个单例,然后程序通过依赖注入的方式引用SessionFacto ...
问题:
使用hibernate 一般会使用到hibernate的延迟加载技术,但是我在第一次使用延迟加载的时候,发现报错,不能取出延迟集合中的值。当时只能不使用延迟加载。
原因:
在dao层把数据取出后,已关闭session,而处理 ...
File file = new File("d:/Data.txt");
if (!file.exists()) {
try {
file.createNewFile();
} catch (IOException e) {
e.printStackTrace();
return;
}
}
OutputStreamWriter os = null;
try {
os = new OutputStreamWriter(new FileOutputStream(file, true));
...
读取excel大概在java中有两种方法,选用apache的POI读取
示例
public class ExportStandName {
/**
* 取得标准表中的标准字段放在一个map的key中
*
* @return standMap
*/
private Map<String, String> readStandExcel() {
Map<String, String> standMap = new HashMap<String, String>();
String filePath = " ...
最近学习了一个quartz 和spring 的定时调度
这个技术的关键是。xml文件的配置问题
<?xml version="1.0" encoding="GBK"?>
<!-- 指定Spring配置文件的Schema信息 -->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p=&q ...
由于在最近做的项目的页面需要添加收藏的功能。写下这个方法来解决这个问题
function AddFavorite() {
var sURL = window.location; //你自己的主页地址
var sTitle = document.title; //你自己的主页名称
try {
window.external.addFavorite(sURL, sTitle);
} catch (e) {
try {
window.sidebar.addPanel(sTitle ...
文件上传:
页面代码:
<form action=''method='post'>
<td><input type="file" name="myFile"/></td>
<td><input type="submit" value="提交"/></td>
</form>
action中代码:
String uploadPath =ServletActionContext.getServletContex ...
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
public class Test6 {
public static String read(String filename) throws IOException{
BufferedReader in=new BufferedReader(new FileReader(filename));
St ...
在最近的一段时间写毕业设计,由于本科阶段的毕业设计不是特别大的项目,所以在数据库连接的这一块就使用了JDBC没有使用框架,但是发现一个好的JDBC工具类也不是那么好写,把自己的记录下来以便以后学习和提高
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
/**
*
* @author XX
* @date 2014-1-22下午10:15:04
*
*/
public class DBUtils {
private stati ...
这段时间在写毕业设计,用到了SSH三大框架的一些技术,但是自己在配置配置文件的时候发现自己对一些配置文件的了解和记忆还不是很牢靠,现在整理下一些常用的配置文件,以便下次使用和复习
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:j ...