I have Hibernate entity that I have to convert to JSON, and I have to translate some values in entity, but when I translate values, these values are instantly saved to datab
You can also avoid that your entities are attached to the Hibernate Session by using a StatelessSession:
StatelessSession session = sessionFactory.openStatelessSession();
instead of
Session session = sessionFactory.getCurrentSession();
Note that you must take care yourself of closing the StatelessSession, unlike the regular Hibernate Session:
session.close(); // do this after you are done with the session
Another difference compared to the regular Session is that a StatelessSession can not fetch collections. I see it's main purpose for data-fetching-only SQLQuery stuff.
You can read more about the different session types here:
http://www.interviewadda.com/difference-between-getcurrentsession-opensession-and-openstatelesssession/