Dear All,
We are developing an rich-client application using (N)Hibernate and have following problem, which is more design-conceptual (which is why we post the question in the more active Hibernate group as well)
We have a catalog of products which is loaded at application startup in a session. Orders have OrderLines which refer to such products. Certain properties of the Product (such as its name) are bound to widgets in our gui. If, at a later stage, we load a number of Orders in another session, the products they refer to will be duplicates of the products in the catalog. This means that, whenever we change the name of a product in the catalog, the gui is not updated since our orders refer to the duplicate Product, which is left untouched.
We do not immediately see a good solution for this.
One way would be to use only one session in our entire application, but that practice is strongly discouraged in most sites/manuals/fora and is likely to lead to memory leaks.
Another technique would be to implement object-caching ourselves outside of nhibernate and replacing the newly created products (as a result of a cascade) by the already existing product instance. Implementing this would require use of interceptors, but the interceptors do not seem to trigger in a findAll operation (only in a findById).
Any help would be very welcome,
Kind regards,
Yves
|