[hibernate-dev] Hibernate Envers > link between to auditable entities
devstack74 at gmail.com
Thu Sep 1 10:11:56 EDT 2016
Thank you for your answer.
1) yes, we can use Set<>
2) When we load an offer we have to load also the associated product.
So, we have to keep the link from offer to product.
the link from product to offer is not needed for now.
2016-09-01 15:55 GMT+02:00 Chris Cranford <crancran at gmail.com>:
> Tarek -
> There are a few ways we can tackle what you want all within the scope of
> but some of it highly depends upon details specific to the relationship
> Product (P) and Offer (O).
> 1. What is the collection type used in Product for the related offers?
> If this happens to be a List<>, would it be possible to use a Set<>
> 2. Is there a requirement that Offer should own the relationship with
> In other words, is it possible to invert the relationship such that the
> collection side is the owner instead?
> On 09/01/2016 06:14 AM, Dev Stack wrote:
>> we have in our model entity P (product) and entity O (offer). The two
>> entities have a link.
>> one instance of P can have one or many O instances.
>> an instance O has a reference to only one instance of P.
>> The link is managed in the O side.
>> P and O are revisioned by Hibernate Envers.
>> Two use cases to cover:
>> 1) If P instance is updated (new revision) we want that O keep the link
>> with the old revision of P.
>> 2) When I update O instance, I will move the reference to the last
>> of O instance.
>> What we did is, inside O class we added to attributes P.id and P.revision.
>> So when we load the object P we use these to fields to load manually (O
>> has reference P DAO).
>> Is there a better way to do it?
>> Should we keep the reference of P in O instance as auditable and Envers
>> will manage?
>> hibernate-dev mailing list
>> hibernate-dev at lists.jboss.org
More information about the hibernate-dev