Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Problem with ReportQuery
Problem with ReportQuery [message #527911] Fri, 16 April 2010 21:39 Go to next message
Tiziano  is currently offline Tiziano Friend
Messages: 6
Registered: April 2010
Junior Member
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 14:21 Go to previous message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

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.



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


Current Time: Fri Mar 29 14:24:47 GMT 2024

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

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

Back to the top