Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] [eclipselink-dev] Single Location for the Named Queries

Hi Tom,
 
    I added the enhancement request for this feature in bugzilla.
 
    here is the address: A facility to group named queries at a central place [Bug 330846]
         
Thanks and Regards,
Samba
 
---------------------------------------------------------------------------------------------------------------------------------------------------------------
On Mon, Nov 22, 2010 at 10:19 AM, Tom Ware <tom.ware@xxxxxxxxxx> wrote:
Please raise the bug as an Enhancement.  We are only allowed to accept code from contributers through bugzilla.

I will tag the bug has having a submitted patch in it when I see it. Periodically, we go through the submitted patches and include the ones we can in the product.

-Tom

Samba wrote:
Hi Tom,
       should I raise a bug with enhancement as the severity or is there any other way to do submit code?

Thanks and Regards,
Samba

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
On Mon, Nov 22, 2010 at 6:03 AM, Tom Ware <tom.ware@xxxxxxxxxx <mailto:tom.ware@xxxxxxxxxx>> wrote:

   Hi Samba,

    Any code contribution you make should be through bugzilla - that is
   a requirement from the Eclipse foundation.

   -Tom


   Samba wrote:

       Hi Eclipse Link Community,
           I think many people might have felt that annotating the
       named queries on entites is difficult to maintain over time and
       some times confusing in a way that finding a proper entity to
       place the query will be difficult in case of queries that fetch
       details from several entities.
        There is already enough frustration documented about this on
       the bloggosphere, for example:
       here <http://jdevelopment.nl/java/put-named-queries-jpa/> and
       here
       <http://freddy33.blogspot.com/2007/07/jpa-namedqueries-and-jdbc-40.html>.

        How about a cental place like a constants file where we can put
       all related named queries in one class, like the one below?
        @*QueryCollection*(
          @NamedQuery(name=NamedQueries.fetchAnnualSalaryOfAnEmployee,
                                query="SELECT EMP.id, EMP.name,
                                EMP.CTC FROM Employee EMP WHERE
       EMP.name=:employeeName"),
         @NamedQuery(name=Named.Queries.fetchEmployeeHierarchy,
                                query="SELECT Emp.id, Emp.name,
                                 Mgr.id,Mgr.name FROM Employee Emp JOIN
                                 Employee.manager Mgr  JOIN
       Emp.department Dept WHERE
                                 Dept.name=:departmentName")
        )
       public class NamedQueries {
               private static final String
       fetchAnnualSalaryOfAnEmployee="fetchAnnualSalaryOfAnEmployee";
               private static final String
       fetchEmployeeHierarchy="fetchEmployeeHierarchy";
        }
        And then we can refer to these while executing the queries from
       the same constants file like:
                      Query
       query=em.createNamedQuery(NamedQueris.fetchAnnualSalaryOfAnEmployee);
                     query.getSingleResult();
        I have implemented this feature in EclipseLink by using the
       same metadata processing framework that is used for dealing with
       named queries on entities.
        I'm attaching the code as zip file to this mail :
       [ one annoation, one meta data processing class, a patch file
       showing the changes made to some four or five eclipselink
       classes, sample entities for testing, and a test case]
         Please review attached code and let me know how to formally
       contribute this feature to the eclipselink project.
        Thanks and Regards,
       Samba
       
       ------------------------------------------------------------------------

       _______________________________________________
       eclipselink-dev mailing list
       eclipselink-dev@xxxxxxxxxxx <mailto:eclipselink-dev@xxxxxxxxxxx>

       https://dev.eclipse.org/mailman/listinfo/eclipselink-dev

   _______________________________________________
   eclipselink-dev mailing list
   eclipselink-dev@xxxxxxxxxxx <mailto:eclipselink-dev@xxxxxxxxxxx>

   https://dev.eclipse.org/mailman/listinfo/eclipselink-dev



------------------------------------------------------------------------

_______________________________________________
eclipselink-dev mailing list
eclipselink-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-dev
_______________________________________________
eclipselink-dev mailing list
eclipselink-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-dev


Back to the top