spring+hibernate 没报错,可就是不能插入数据库,急急急!!

代码如下: 测试类: package com.test;

import com.dao.PersonDao; import com.po.Person;

import org.springframework.context.ApplicationContext; import org.springframework.context.support.FileSystemXmlApplicationContext;

public class PersonDaoTest { public static void main(String[] args) throws Exception { ApplicationContext applicationContext=new FileSystemXmlApplicationContext("WebRoot/WEB-INF/classes/applicationContext.xml"); PersonDao personDao=(PersonDao)applicationContext.getBean("personDaoImpl"); Person person=new Person(); person.setAge(22); person.setName("xqy1"); System.out.println("导入数据开始......."); personDao.insert(person); System.out.println("导入数据结束......."); } }

配置文件:Person.hbm.xml

运行结果: log4j:WARN No appenders could be found for logger (org.springframework.context.support.FileSystemXmlApplicationContext). log4j:WARN Please initialize the log4j system properly. 导入数据开始....... 导入数据结束.......

我用的是mysql,数据库就是没数据,急死俺列!!

请检查事务配置,或更改提交模式。

困扰了我两天的问题终于解决了,我没申明提交事务的代理。框架的整合对我像我这样的新手还真是不简单啊,从中我加深了对框架的更深一层次的理解,不错不错,以前是大大滴痛苦,现在是大大滴爽啊,呵呵!谢了,前辈! [该贴被Jxqy于2009-04-05 17:11修改过]

一年之后再来逛逛,感觉真的有很大不同,什么都变了