hibernate automatically saves/edits objects that are updated

hibernate automatically saves/edits objects that are updated

Kind of mysterious – all you want to do would be to update the some component on your java logic and it is automatically saved in the database.
Here is the typical scenario, if you are updating collection of objects and and updating one object would also update others based on some logic – say reordering of numbers, the session would all be saved without saving all the collections – yup I got this exact situation and the reason was

After the update, I have another ajax call to the backend where I would get the list of objects. And the method which collect the objects was annotated as Transactional. In this case, all the dirty objects in the session would be saved though what I wanted was to read only.

So, I changed the annotation to Transactional(readOnly=true) – that took care of it.

See how you would solve these known algorithm problems

Implementing tokenizer and adding tokens to the linked list

Find longest palindrom from sequence of characters

Find the pairs that makes K Complementary in the given array java solution

Changing decimal number to its binary equivalent

Find the first occurence of number in the sorted array

Check if there are three numbers a, b, c giving a total T from array A

Java solution for checking anagram strings – tell if phrases are anagrams

Check if two strings are anagrams or not

String Ordered Permutation Algorithm Problem

Finding missing numbers from billion sequential number list file

3 Comments
  1. stokito

    I had same problem. Solved by using load() instead get()

    1. gullele

      Thanks for the input, I will check it with load also.

      1. stokito

        Sorry, read(), not load()

Leave a Reply

Your email address will not be published. Required fields are marked *

*
*