Skip to main content



      Home
Home » Eclipse Projects » EclipseLink » Problem with ReportQuery
Problem with ReportQuery [message #527911] Fri, 16 April 2010 17:39 Go to next message
Eclipse UserFriend
Hello everybody
I'm very new to Java and EclipseLink so apologize me for my maybe stupid question. I use a entitymanger and a query to populate a jtable (a binded jtable). At the end of my jframe i insert another jtable that have to show totals of my envoice (another binded jtable). In order to show total i use ReportQuery. The report query update my total only when I call EntityManger.GetTransaction().COMMIT.
My question is ReportQuery work in a disconnected way. If so my total would me updated without call EntityManger.GetTransaction().commit and read data from database. I misunderstand something.
I use such code in order to update my total and this work fine only when i call EntityManager.getTransaction().commit
private void AggiornaTotaliFattura() {

Session uow = ((EntityManagerImpl) entityManager1).getActiveSession();
try {
Integer idFatt = (CurrentRecord == null ? 0 : CurrentRecord.getNIdFattura());
Expression idFatturaExpression;
ExpressionBuilder emp= new ExpressionBuilder(TFattureR.class);
ReportQuery query = new ReportQuery(TFattureR.class, emp);
query.addAttribute("nIvaPercentuale");
query.addSum("nImponibile", ExpressionMath.multiply(emp.get("nImponibile"), emp.get("nQta")));
query.addGrouping(emp.get("nIdFattura"));
query.addGrouping(emp.get("nIvaPercentuale"));
idFatturaExpression = emp.get("nIdFattura").equal(emp.getParameter("parIDFATTURA "));
query.setSelectionCriteria(idFatturaExpression);
query.addArgument("parIDFATTURA");
List args = new ArrayList();
args.add(this.CurrentRecord);
setTotaleFattura((List) uow.executeQuery(query, args));

} catch (Exception e) {
e.printStackTrace();
}

}


thank for any suggestions
Tiziano
Re: Problem with ReportQuery [message #528150 is a reply to message #527911] Mon, 19 April 2010 10:21 Go to previous message
Eclipse UserFriend
Not sure I understand.

Is you issue you are in a transaction and have made changes and want the report query result to reflect those changes? In this case you can call EntityManager.flush() to flush the current changes to the database, this will allow the report query to see the changes.

Previous Topic:Problem with Aggregates function and Aritmetics Operation
Next Topic:cascade insert not working on Eclipselink event
Goto Forum:
  


Current Time: Sun Aug 31 01:03:32 EDT 2025

Powered by FUDForum. Page generated in 0.03790 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top