> Hi Gilberto,
> 
> I think you might have encountered an issue with caching.
> 
> When you persist the Item entity, the reference to Produto is null (I
> didn't see anywhere that you set it). So when you retrieve it, openjpa
> doesn't go to the database but simply returns what is in the (second
> level) cache. In the cache, the object that was stored is retrieved.
> 
Can I disable that behavior(second level cache) on some operations?

> JPA spec (at the JPA 1.0 level) that the application manage both sides
> of relationships. In the code below, can you add a statement that sets
> the Produto field in Item before commit?
Yes! Now it works.
Thanks,

Gilberto
www.secad.to.gov.br

Reply via email to