Hibernate update entity doesn't work

时间:2017-10-12 09:41:39

标签: java hibernate

So i have this entities:

Twitch channel class

Channel command class

And when I try to update TwitchChannel entity, using session.update(), nothing really happens. It doesn't throw an exception or log anything, code after update call doesn't get executed. I set hibernate's batch size to zero, so it shouldn't batch updates.

Update function in dao looks like this:

update channel function

channelDao.update() simply calls session.update().

1 个答案:

答案 0 :(得分:0)

Thank to @Pijotrek, wrapping update call in try/catch block helped and hibernate actually threw:

Illegal attempt to associate a collection with two open sessions

Replacing session.update() with session.merge() solved the issue!