日期:2014-05-20 浏览次数:20748 次
@Override
public int insert(T t) {
Serializable s=sessionFactory.getCurrentSession().save(t);
System.out.println(11);
return (s != null)?(Integer)s:-1;
}
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations={"classpath:config/applicationContext.xml"})
@Transactional(propagation=Propagation.REQUIRED)
public class TestFavoriteDao {
@Resource(name="favoriteDao")
private IFavoriteDao favoriteDao;
/**
* Test method for {@link com.accp.dao.FavorteDao#add(com.accp.domain.Favorite)}.
*/
@Transactional
@Test
public void testAdd() {
Favorite fav = new Favorite();
fav.setDesc("test");
fav.setLabel("java");
fav.setTags("java");
fav.setUrl("www.java.com");
int s=favoriteDao.add(fav);
System.out.println(s);
}