1 Reply Latest reply on Apr 26, 2012 1:47 AM by Adam Warski

    versioned relations

    Livia Hauser Newbie

      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