使用休眠读取然后删除对象时出现 StackOverflowError
我正在读取一个对象,然后简单地删除它,它会抛出 java.lang.StackOverflowError!
public class TestDummy extends TestCase {
@Autowired
private ApplicationContext context;
@Autowired
private AccountDao accountDao;
public void testDeleteAccount(){
Account acc = accountDao.get("9BE4BFA718EA4B4EE044000077B05A84");
System.out.println("Account name is "+acc.getAccountName());
accountDao.delete(a);
}
accountDao
和 context 实例化良好。
这是 get() 和 delete() 方法
public Account get(String id) {
Account acc = getHibernateTemplate().get(Account.class, id);
return acc;
}
public void delete(Account account) {
delete(account);
}
我想知道这里会递归发生什么!
请指教。
I am reading an objects and then simply deleting it and it throws java.lang.StackOverflowError!
public class TestDummy extends TestCase {
@Autowired
private ApplicationContext context;
@Autowired
private AccountDao accountDao;
public void testDeleteAccount(){
Account acc = accountDao.get("9BE4BFA718EA4B4EE044000077B05A84");
System.out.println("Account name is "+acc.getAccountName());
accountDao.delete(a);
}
}
accountDao and context are instantiating good.
here is get() and delete() methods
public Account get(String id) {
Account acc = getHibernateTemplate().get(Account.class, id);
return acc;
}
public void delete(Account account) {
delete(account);
}
I wonder what can be recursively happening here!
Please advice.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
难怪你会这样。
No wonder you get SO.
导致堆栈溢出的递归被无耻地隐藏在这里:
Recursion causing stack to overflow is shamelessly hidden here: