Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Expression Builder Union With Sub Queries [2.5]
Expression Builder Union With Sub Queries [2.5] [message #1070902] Thu, 18 July 2013 23:11
brad Mising name is currently offline brad Mising name
Messages: 17
Registered: February 2010
Junior Member
Hey guys I'm playing around with unions in 2.5. I haven't been able to find many examples of using an Union with subqueries so I am in the process of guess and test. Here's what I have found to work best so far with made up entities:


        ExpressionBuilder archivedBooksExpressionBuilder = new ExpressionBuilder();
        ReportQuery archivedBooksSubQuery = new ReportQuery(Book.class, archivedBooksExpressionBuilder);
        archivedBooksSubQuery.addAttribute("bookKey");
        archivedBooksSubQuery.setSelectionCriteria(archivedBooksExpressionBuilder.get("something").anyOf("anything").get("book").get("bookKey").in(dataAccessModel.getSomeKeys()));

        ExpressionBuilder shelvedBooksExpressionBuilder = new ExpressionBuilder();
        ReportQuery shelvedBooksSubQuery = new ReportQuery(Book.class, shelvedBooksExpressionBuilder);
        shelvedBooksSubQuery.addAttribute("bookKey");
        shelvedBooksSubQuery.setSelectionCriteria(shelvedBooksExpressionBuilder.anyOf("somethingElse").get("book").get("bookKey").in(dataAccessModel.getAnyKeys()));

        archivedBooksSubQuery.union(shelvedBooksSubQuery);

        return expressionBuilder.get("generalKey").in(archivedBooksSubQuery);


This doesn't create the UNION quite right. Any suggestions?
Thanks
-Brad

Previous Topic:Read operation returns me old value before commit. Why?
Next Topic:EclipseLink in RCP: javax.naming.NoInitialContextException
Goto Forum:
  


Current Time: Thu Sep 18 05:55:00 GMT 2014

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

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