Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

2
  • method someTimeConsumingProcessingOfEntityFields(entityDb) updates multiple complex fields of class Entity so it would be quite difficult to duplicate all this code using native queries. (In reality I have much more classes with similar problem - so I am looking for some elegant non intrusive solution). And second problem with using native queries with hibernate it it leaves domain object in "inconsistent" state. Commented Nov 28, 2015 at 17:45
  • And second problem with using native queries with hibernate: it leaves domain object in "inconsistent" state (after native query updates domain objects directly in DB hibernate session will contain different objects values). This can be problem for code reusability (you will not be able to pass current objects to other method - firstly you need to update them from DB) Commented Nov 28, 2015 at 17:53