Re: Cayenne 4.2—Modifying SQL generation to always use COALESCE when updating a certain column

2020-09-14 Thread Hugi Thordarson
First glance at that API looks real nice, I'm going to check this out, thanks :) - hugi > On 11 Sep 2020, at 07:06, Andrus Adamchik wrote: > > 4.2 for the first time exposes generated SQL as an AST, so tweaking it has > become much easier. This is the feature that made possible to support >

Re: Cayenne 4.2—Modifying SQL generation to always use COALESCE when updating a certain column

2020-09-11 Thread Andrus Adamchik
4.2 for the first time exposes generated SQL as an AST, so tweaking it has become much easier. This is the feature that made possible to support geospatial and JSON types. Nikita, please correct me if I am wrong with the following instructions (as this API is still in flux). So.. To customize p

Re: Cayenne 4.2—Modifying SQL generation to always use COALESCE when updating a certain column

2020-09-08 Thread Hugi Thordarson
Thanks John, not a bad idea. I'd prefer it if the current method ports though (since I'd have to create triggers for something like 200 columns). But if that isn't possible we might consider this. - hugi > On 8 Sep 2020, at 20:33, John Huss wrote: > > Since you are already at the DB level

Re: Cayenne 4.2—Modifying SQL generation to always use COALESCE when updating a certain column

2020-09-08 Thread John Huss
Since you are already at the DB level (outside of cayenne) making this change, I would just use a BEFORE UPDATE row-level trigger in Postgres. You can change the value there. Something like this would work: CREATE OR REPLACE FUNCTION company_default() RETURNS trigger AS $$ BEGIN

Cayenne 4.2—Modifying SQL generation to always use COALESCE when updating a certain column

2020-09-08 Thread Hugi Thordarson
Working with old DB designs really results in the weirdest questions… So… I've been working around a design problem in a customer DB by using my own BatchTranslatorFactory. The functionality was that if a column is called "company", every update wraps the column's new value in a coalesce functio

Re: 4.0M4 - After Updating to M4 Modeler Wants Me To Drop All My Tables When Migrating DB Schema

2016-12-15 Thread Nikita Timofeev
; -- > View this message in context: http://cayenne.195.n3.nabble. > com/4-0M4-After-Updating-to-M4-Modeler-Wants-Me-To-Drop- > All-My-Tables-When-Migrating-DB-Schema-tp4028339.html > Sent from the Cayenne - User mailing list archive at Nabble.com.

4.0M4 - After Updating to M4 Modeler Wants Me To Drop All My Tables When Migrating DB Schema

2016-12-15 Thread fael
yenne.195.n3.nabble.com/4-0M4-After-Updating-to-M4-Modeler-Wants-Me-To-Drop-All-My-Tables-When-Migrating-DB-Schema-tp4028339.html Sent from the Cayenne - User mailing list archive at Nabble.com.

Re: Updating totals in a multi-user environment

2014-11-02 Thread Andrus Adamchik
gt; String using a JPQL-like object query language, so you forfeit the type >>> safety of SelectQuery. Still it is a much better abstraction then >>> SQLTemplate for instance. (And its integration into SelectQuery is on the >>> agenda). >>> >>> Andrus &g

Re: Updating totals in a multi-user environment

2014-11-02 Thread Mark Stobbe
t 31, 2014, at 1:38 AM, Mark Stobbe >> wrote: >> > >> > @Andrus, I see. Good to know how to do this in Cayenne. >> > >> > @Michael, You are right. It makes more sense to let the database do the >> calculations. It prevents the race conditions when u

Re: Updating totals in a multi-user environment

2014-11-01 Thread Mark Stobbe
chael, You are right. It makes more sense to let the database do the > calculations. It prevents the race conditions when updating and ensures > totals to be correct. > > My problem with the solution is just the integration into Cayenne. > > Do you use some extra classes to keep th

Re: Updating totals in a multi-user environment

2014-10-31 Thread Andrew Lindesay
Hello Hugi; You should be able to use EJBQL for this purpose as well. Here is a (nicely re-formatted) example; SELECT DISTINCT ur.user.nickname FROM UserRating ur WHERE ur.user.active=true AND ur.active=true Have a go and see if it fits your needs. As Andrus has pointe

Re: Updating totals in a multi-user environment

2014-10-31 Thread Aristedes Maniatis
On 31/10/2014 8:58pm, Hugi Thordarson wrote: > Once again, I’m looking into migrating to Cayenne from EOF :). One question > though: Our code depends heavily on raw row fetching (data rows) that > traverses relationships. I haven’t looked much at the Cayenne code, but do > you believe adding sup

Re: Updating totals in a multi-user environment

2014-10-31 Thread Hugi Thordarson
gt; @Andrus, I see. Good to know how to do this in Cayenne. >> >> @Michael, You are right. It makes more sense to let the database do the >> calculations. It prevents the race conditions when updating and ensures >> totals to be correct. >> My problem with the soluti

Re: Updating totals in a multi-user environment

2014-10-31 Thread Andrus Adamchik
s in Cayenne. > > @Michael, You are right. It makes more sense to let the database do the > calculations. It prevents the race conditions when updating and ensures > totals to be correct. > My problem with the solution is just the integration into Cayenne. > Do you use some extra

Re: Updating totals in a multi-user environment

2014-10-30 Thread Michael Gentry
w to do this in Cayenne. > > @Michael, You are right. It makes more sense to let the database do the > calculations. It prevents the race conditions when updating and ensures > totals to be correct. > My problem with the solution is just the integration into Cayenne. > Do you use some e

Re: Updating totals in a multi-user environment

2014-10-30 Thread Mark Stobbe
@Andrus, I see. Good to know how to do this in Cayenne. @Michael, You are right. It makes more sense to let the database do the calculations. It prevents the race conditions when updating and ensures totals to be correct. My problem with the solution is just the integration into Cayenne. Do you

Re: Updating totals in a multi-user environment

2014-10-30 Thread Michael Gentry
The utilities I mentioned also do SUM, AVG, MIN, and MAX ... On Thu, Oct 30, 2014 at 12:35 PM, Mark Stobbe wrote: > Oh, I also have the same problem with total cost with different > currencies... > > On Thu, Oct 30, 2014 at 5:09 PM, Mark Stobbe wrote: > >> Hi Michael, >> >> I would like to disp

Re: Updating totals in a multi-user environment

2014-10-30 Thread Michael Gentry
Hi Mark, In general I don't like storing data that is easily calculated from the DB itself. (Although I've made exceptions when it was computationally expensive and impractical to do the calculation.) Some options you could try: * Fetch a fresh order and then: order.getPackages().size(). * Fetc

Re: Updating totals in a multi-user environment

2014-10-30 Thread Andrus Adamchik
etween multiple processes updating the same order (or fetch and update Order object, if you don't expect this to happen). Andrus > On Oct 30, 2014, at 7:09 PM, Mark Stobbe wrote: > > Hi Michael, > > I would like to display the count in a table for a whole bunch of orders.

Re: Updating totals in a multi-user environment

2014-10-30 Thread Mark Stobbe
Oh, I also have the same problem with total cost with different currencies... On Thu, Oct 30, 2014 at 5:09 PM, Mark Stobbe wrote: > Hi Michael, > > I would like to display the count in a table for a whole bunch of orders. > In theory I could use a "group by"-query to get the numbers I need and >

Re: Updating totals in a multi-user environment

2014-10-30 Thread Mark Stobbe
Hi Michael, I would like to display the count in a table for a whole bunch of orders. In theory I could use a "group by"-query to get the numbers I need and with proper configured indices this should be fairly quick, I guess. Is there a more transparent way of doing things, e.g. using lifecycle l

Re: Updating totals in a multi-user environment

2014-10-30 Thread Michael Gentry
Hi Mark, Is there a performance reason why you don't just do a count on the packages that match the order? mrg On Thu, Oct 30, 2014 at 11:00 AM, Mark Stobbe wrote: > Hi all, > > I was wondering what is the best way to update totals in a multi-user > environment. For example, let's say we have

Updating totals in a multi-user environment

2014-10-30 Thread Mark Stobbe
Hi all, I was wondering what is the best way to update totals in a multi-user environment. For example, let's say we have an Order which can have one or more Packages associated and we want to maintain a total package count on the Order entity. How would you update this value when the user has the

Updating a flattened relationship when a rel. it depends on is modified?

2011-11-29 Thread Hugi Thordarson
Hi all. The subject says it all, really. Do I have any way to automatically update a flattened relationship when one of the relationships it depends on is updated? To clarify, let's say I have the following schema: Employee <<> Department <<> Company. "Company" has a flattened relations

Re: Updating Cayenne Advice 1.x => 3.0: createAndRegisterNewObject is deprecated...

2009-10-21 Thread Kevin Menard
Hi Eric, It's been a while since I've upgraded from 1.x. Cayenne 2.x should be API compatible with 1.2, save for the new apache package names. The changes from 2.x to 3.x were mostly backward compatible. If you wanted to, you could upgrade in two steps, using 2.x to make sure you got all the ob

Updating Cayenne Advice 1.x => 3.0: createAndRegisterNewObject is deprecated...

2009-10-21 Thread Eric Lazarus
We have been using 1.x happily for years and now finally have a reason to upgrade: our need for embedded database (e.g., H2) support. Seems like createAndRegisterNewObject is deprecated. I assume we are supposed to use one or another version of newObject() instead. Is that right? What else shoul

Re: updating...

2009-07-22 Thread Juan Toro Marty
that you are populating, into datacontext. >> >> Check ur this.getPerfil(objid), the object that you are updating must be >> created into context or by a query >> SelectQuery q=new SelectQuery(this.queryClass); >> List data = ctx.performQuery(q); >> >>

Re: updating...

2009-07-22 Thread Juan Toro Marty
populating, into datacontext. > > Check ur this.getPerfil(objid), the object that you are updating must be > created into context or by a query > SelectQuery q=new SelectQuery(this.queryClass); > List data = ctx.performQuery(q); > > where data is a List of queryClass object

Re: updating...

2009-07-22 Thread Emanuele Maiarelli
this.datacontext.commitChanges(); is correct I fear u didn't create the object that you are populating, into datacontext. Check ur this.getPerfil(objid), the object that you are updating must be created into context or by a query SelectQuery q=new SelectQuery(this.queryClass); List

Re: updating...

2009-07-22 Thread Andrus Adamchik
On Jul 22, 2009, at 1:01 PM, Juan Toro Marty wrote: Perfiles perfil = this.getPerfil(objid);//with this i retrieve an object Perfil. then... perfil.setName = name; perfil.setAge = age; etc... this.datacontext.commitChanges(); assuming 'perfil' is created in the same 'datacontext' as 'th

updating...

2009-07-22 Thread Juan Toro Marty
Can anybody helpme teachme any way to make an update... i am using the following way: Perfiles perfil = this.getPerfil(objid);//with this i retrieve an object Perfil. then... perfil.setName = name; perfil.setAge = age; etc... this.datacontext.commitChanges(); but nothing happens... is this th

RE: Updating DataMap through ROP client

2009-02-18 Thread Zissis Trabaris
email from your system. Thank you. -Original Message- From: Andrey Razumovsky [mailto:razumovsky.and...@gmail.com] Sent: Tuesday, February 17, 2009 3:01 PM To: user@cayenne.apache.org Subject: Re: Updating DataMap through ROP client Hi again, I've done some surfing through the

Re: Updating DataMap through ROP client

2009-02-17 Thread Andrey Razumovsky
or use is prohibited. If you received this email in error, > please notify the sender and delete this email from your system. Thank > you. > > > -Original Message- > From: Andrey Razumovsky [mailto:razumovsky.and...@gmail.com] > Sent: Tuesday, February 17, 2009 12:21 PM &g

RE: Updating DataMap through ROP client

2009-02-17 Thread Zissis Trabaris
d. If you received this email in error, please notify the sender and delete this email from your system. Thank you. -Original Message- From: Andrey Razumovsky [mailto:razumovsky.and...@gmail.com] Sent: Tuesday, February 17, 2009 12:21 PM To: user@cayenne.apache.org Subject: Re: Updating Da

Re: Updating DataMap through ROP client

2009-02-17 Thread Andrey Razumovsky
your system. Thank > you. > > > -Original Message- > From: Andrey Razumovsky [mailto:razumovsky.and...@gmail.com] > Sent: Monday, February 16, 2009 3:15 PM > To: user@cayenne.apache.org > Subject: Re: Updating DataMap through ROP client > > I don't know deta

RE: Updating DataMap through ROP client

2009-02-16 Thread Zissis Trabaris
movsky.and...@gmail.com] Sent: Monday, February 16, 2009 3:15 PM To: user@cayenne.apache.org Subject: Re: Updating DataMap through ROP client I don't know details of Hessian, but I don't think HessianServlet caches any data. Have you tried simply clearing client context's cache? 2009/2

Re: Updating DataMap through ROP client

2009-02-16 Thread Andrey Razumovsky
azumovsky [mailto:razumovsky.and...@gmail.com] > Sent: Sunday, February 15, 2009 1:10 PM > To: user@cayenne.apache.org > Subject: Re: Updating DataMap through ROP client > > Hi Zissis, > > DbEntities are not being sent to client (and DataMap is sent trimmed). > So I > don&

RE: Updating DataMap through ROP client

2009-02-15 Thread Zissis Trabaris
[mailto:razumovsky.and...@gmail.com] Sent: Sunday, February 15, 2009 1:10 PM To: user@cayenne.apache.org Subject: Re: Updating DataMap through ROP client Hi Zissis, DbEntities are not being sent to client (and DataMap is sent trimmed). So I don't think you can perform DataMap changes from client. W

Updating DataMap through ROP client

2009-02-15 Thread Zissis Trabaris
We have an ROP client that acts as a modeler for our runtime application. Is there any way to modify a DataMap via an ROP client layer, synchronize the DB schema like I would do using ExecutingMergerContext at the server layer and then clear the server and client object caches without dropping the

Re: Updating DataMap through ROP client

2009-02-15 Thread Andrey Razumovsky
Hi Zissis, DbEntities are not being sent to client (and DataMap is sent trimmed). So I don't think you can perform DataMap changes from client. What I would try to do is to write a custom query which performs your operations and the fire it from the client. I'm not sure this will work though. Reg

Updating DataMap through ROP client

2009-02-15 Thread Zissis Trabaris
We have an ROP client that acts as a modeler for our runtime application. Is there any way to modify a DataMap via an ROP client layer, synchronize the DB schema like I would do using ExecutingMergerContext at the server layer and then clear the server and client object caches without dropping the