>> I do not want to write SQL query in SQL TEMPLETE or EJBQLQuery, >> because I have two databases MS SQL server and PostgreSQL and both of them >> have syntactical difference.
BTW EJBQL is expressed in object terms, so there is no "native" SQL in it and it is fully DB-agnostic. So it gives you the best of both worlds - direct DB updates, but DB-independent syntax. >> Because I already have id which I want to update, so why would I use select >> query ?. I am >> dealing with more then 25 lakhs record. Direct updates vs select-then-update is a tradeoff of performance vs. clarity of design and reuse of the object code. E.g. in a batch job that needs to process lots of objects, but doesn't have a user waiting for an immediate response, select-then-update approach may be preferable. And Cayenne supports iterated queries that allow you to process an infinite number of objects without crashing your app: https://cayenne.apache.org/docs/3.1/cayenne-guide/performance-tuning.html#iterated-queries This API is much more user-friendly in 4.0, but 3.1 version is still fully functional. So you may consider this tradeoff in your situation. Andrus > On Sep 12, 2015, at 10:45 AM, John Huss <johnth...@gmail.com> wrote: > > SqlTemplate allows you to define different queries for different databases > and chooses the correct one at runtime. > > > On Sat, Sep 12, 2015 at 7:51 AM Dipesh Jain <dip...@ivgroup.in> wrote: > >> @Ari I do not want to write SQL query in SQL TEMPLETE or EJBQLQuery, >> because I have two databases MS SQL server and PostgreSQL and both of them >> have syntactical difference. I want to use predefined manipulation and >> updation methods in cayenne, so that if I change database I do not have to >> write SQL queries again. >> >> @Andrus my concern is first select a record and then updating it does >> not take more time then direct updation. Because I already have id >> which I want to update, so why would I use select query ?. I am >> dealing with more then 25 lakhs record. >> >> >> On Fri, Sep 11, 2015 at 9:02 PM, Dipesh Jain <dip...@ivgroup.in> wrote: >> >>> I am using apache cayenne 3.1. I know of one way to update records in the >>> database is to first use select query to find record and then update it, >>> but I don't want to use a select query for updating. How can I directly >>> update the record? I do not want to use EJBQLQuery or SQL TEMPLETE. >>> >>> -- >>> Thanks and Regards >>> Deepesh Jain >>> >> >> >> >> -- >> Thanks and Regards >> Deepesh Jain >>