|Find after persist - ignoring cache [message #810028]
||Wed, 29 February 2012 10:35
| Mauro Flores
Registered: September 2009
I have an entity Foo with an eager manytoone relationship with Boo. I run the following code and the System.out shows null: |
Foo f = new Foo();
Boo b = new Boo();
Foo fret = em.find(Foo.class, f.getId());
The find method brought de Foo object from the cache, I wished a new query was execute bringing all the propeties of the Boo.
Even If I replace the find by the following query the result is the same:
Query q = em.createQuery("SELECT f from Foo f where f.id = " + f.getId()).setHint(QueryHints.CACHE_USAGE, CacheUsage.DoNotCheckCache);
Foo fret = (Foo) q.getSingleResult();
If I make the query or the find after the commit, the content of the property name of Boo is shown as expected.
How can I have the same behaviour before executing the commit?
Powered by FUDForum
. Page generated in 0.08808 seconds