2009-07-22

Hibernate HOWTO Update Composite-id

updating primarey key is not really nice but i think you don't have the choice.

Instead of load + set + commit you should try load + new instance + copyAllProperties + set the key you want to modify + save(newObj) + delete(oldObj) + commit

In my opinion it's more OO logic even if it seems a little bit complicated

0 留言: