开发者

StackOverflowError while reading then deleting object with hibernate

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开发者_JAVA技巧 "+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.


public void delete(Account account) 
{
   delete(account);
}

No wonder you get SO.


Recursion causing stack to overflow is shamelessly hidden here:

public void delete(Account account) {
    delete(account);
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜