Hi all,
I'm new on envers. I looking for a solution to create a mapping which will use "versioned relations". The following shows the problem:
{code}
Invoice invoice = new Invoice(.... );
ExchangeRate exRate = new ExchangeRate( "USD", "EUR", 0.82 );
invoice.setExchangeRatge( exRate );
em.persist( invoice );
//some times later:
exRate.setValue( 0.85 );
em.persist( exRate );
invoice.setDiscount( ... );
em.persist( invoice );
//some times later:
Invoice invoice = em.find( .. );
//invoice.getEchangeRate() should return NOT return the current Version. Every time it should return the version which is set
invoice.getExchangeRate().getValue() // must be 0.82 NOT 0.85
{code}
Is it possible to do this using envers?
Regards,
Liv
Sorry, but that's not possible. What you could do with Envers is get the Invoice as it was at a specific date - this instance would point to the desired exchange rate. But the behavior of "current" entities is unchanged.
Adam