简体   繁体   中英

Hibernate update entity doesn't work

So i have this entities:

抽搐频道班

通道命令类

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:

更新频道功能

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

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!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM