1 Reply Latest reply on Apr 3, 2008 7:59 AM by Nicklas Karlsson

    auto flush problem?

    x y Newbie

      hi - i am trying to implement a save as function in a home class based on EntityHome and the idea is to create a new User based on an existing user. i created a new function as follows but the existing user instance too gets changed, although i didn't update it explicitly. is there a way to stop this auto save from happening? thanks.

           public String persistAsNew() 
                User nu =  new User();

        • 1. Re: auto flush problem?
          Nicklas Karlsson Master

          What gets changed in the original user? If you are using hibernate you can use extended feature to generate update statements for only the changed attributes to help you see the modification.

          There is of course the entityManager.clear() before save but that could be overkill and have undesired side effects