Yazmin - sounds like some kind of DataNucleus behavior. In general, depending on how you have declared the relationships between your data objects, or some of your JDO configuration options, JDO/DataNucleus might be caching some of the results in the "related" collection of objects. Chances are that when you start iterating over the collection it is actually forced to go out to the database and refresh the values.
I don't expect this to be a trivial problem, but if you provide more details about your : a) JDO config options b) how you have declared Product / Almacen c) your DAO code , someone might be able to help out further. Cheers - Alex K On Mon, Aug 24, 2015 at 8:19 PM, yazmin georgina quintal < geolit...@yahoo.com.mx> wrote: > I am using Tapestry 5.4, and integrating datanucleus using tynamo. > > In my page.java, i get some data to show in page.tml: > @CommitAfter > public List<Product> getResults() { > String filter = getFilter(); > List<Product> resultados = > getDao().getStockDao().getExistenciasGeneralesWidthProductFilter(filter); > return resultados; > } > The problem is that I always get the same results (the same I got from > firs invocation of my page), but I am sure the results should change > because I change the underlying rows in db between invocations of my page > (committing changes, obviously) > > I had traced many executions path and I am sure, I get a new > PersistenceManager for each request. > > If I replace the results from JDO with a random generated result list of > Products, I get the page with random result in each invocation, as > expected. So this happen only with JDO results. > > More strange is that if I make the following changes (iterate the > results), I get the final page changed on every request as expected from > intervening db changes: > > @CommitAfter > public List<Product> getResults() { > String filter = getFilter(); > List<Product> resultados = > getDao().getStockDao().getExistenciasGeneralesWidthProductFilter(filter); > for (Product p : resultados) { > System.out.println(p.getName() + ":" + > p.getExistenciasCorporativas().hashCode()); > for (Almacen a : p.getExistenciasCorporativas().keySet()) { > System.out.println(" " + a.getNombre() + ": " + > p.getExistenciasCorporativas().get(a).getUnits().intValue()); > } > } > return resultados; > } > > > ... and more strange, the output I get on console is always the same (the > results of the firsts invocation of the page).... but the page shows the > modified results expected from direct modification of the db. > > I Know tapestry weave my page.java, I think that by some reason the > weaving is replacing variable resultados with a cached value and using it > in place of the returned value from JDO, but I do not understand why it > does so only with JDO results and not with the manual results and why > iterating the JDO results make the template get the updated results while > then iteration on page.java get always the first results ever gotten. > > ¿Maybe the kind on List wrapper of datanucleus ? > > Any idea will be appreciated. > Saludos. Atte. Yazmín Georgina Quintal Moo Local 63 y 64 de Plaza de la > Tecnología. Villahermosa, Tab. Tel 993 1311688 Cel. 9932 476367