使用ssh框架做新增功能时无法将数据写入数据库

在spring配置文件中配置了事务管理



</context:component-scan

而且在类上面也开启了事务注解:
import javax.transaction.Transactional;

import com.dao.YongHuDao;
import com.entity.YongHu;
import com.service.YongHuService;
@Transactional
public class YongHuServiceImpl implements YongHuService {
private YongHuDao yhdi;

@Override
public void add(YongHu t) {
    yhdi.add(t);
}




控制台没有错误信息,只输出一条查询伪表id的sql语句:
DEBUG - Found thread-bound Session for HibernateTemplate

DEBUG - trace com.mchange.v2.resourcepool.BasicResourcePool@58aff4cd managed: 3, unused: 2, excluded: 0
Hibernate:
select
hibernate_sequence.nextval
from
dual
DEBUG - Not closing pre-bound Hibernate Session after HibernateTemplate
hahahhaah26hahahahhahha
DEBUG - Entering nullPropertyValue [target=[com.entity.YongHu@2e81070, com.action.UserAction@3e625613, com.opensymphony.xwork2.DefaultTextProvider@17e36931], property=struts]
DEBUG - Entering nullPropertyValue [target=[com.entity.YongHu@2e81070, com.action.UserAction@3e625613, com.opensymphony.xwork2.DefaultTextProvider@17e36931], property=org]
DEBUG - after Locale=zh_CN

实在找不出哪里错了,求大神解答

解决了,找了大半天,发现是注解式事务管理配置错了,没办法提交事务导致的

从你这片面的代码看不出来,错在那个,除非你把代码全弄上来,但这样大家时间都浪费了,建议你自己用Debug模式,排查问题原因。望采纳,谢谢

首先打桩 System.out.println(t);看你传过来的数据、
如果数据没错就检查你的Hsq,字段和实体类字段有没有对应。调用的方法名字和id是否一致