AbstractTransactionalJUnit4SpringContextTests 的测试问题?
loveExtJs
2010-06-07
继承于此类
@Before public class UserDaoTest extends AbstractTransactionalJUnit4SpringContextTests{ @Autowired private UserDao userDao; @Before public void testSave(){ userDao.save(...)//插入数据 } @Test public void testGet(){ userDao.get(1); } } hibernate里的<prop key="hibernate.hbm2ddl.auto">create</prop> 设置为create,没有问题。设为update,就报找不到该ID的User(org.hibernate.ObjectNotFoundException: No row with the given identifier exists:) 把数据库删了,在运行也没问题。看输入的sql,insert语句是执行了的。 求解! |