Re: Order of operations?

2016-06-22 Thread Michael Gentry
I believe I inquired about the ordering years ago and I think Andrus gave a reason why, but it escapes me at the moment. Perhaps he will remember and chime in here. mrg On Wed, Jun 22, 2016 at 6:58 PM, Aristedes Maniatis wrote: > On 23/06/2016 5:25am, Lon Varscsak wrote: > > Okay, I’ve found

Re: Order of operations?

2016-06-22 Thread Aristedes Maniatis
On 23/06/2016 5:25am, Lon Varscsak wrote: > Okay, I’ve found where it’s at (DataDomainFlushAction.preprocess). I don’t > see an easy way to override this, without just forking (which is totally > doable). Does anyone know why the default order of operations is INSERT -> > UPDATE -> DELETE? Becau

Re: Order of operations?

2016-06-22 Thread Lon Varscsak
Okay, I’ve found where it’s at (DataDomainFlushAction.preprocess). I don’t see an easy way to override this, without just forking (which is totally doable). Does anyone know why the default order of operations is INSERT -> UPDATE -> DELETE? Because if there’s no specific reason, it seems like we

Re: Order of operations?

2016-06-22 Thread Lon Varscsak
Do you know where in code Cayenne does this operation? On Tue, Jun 21, 2016 at 6:58 PM, Aristedes Maniatis wrote: > On 22/06/2016 11:47am, Lon Varscsak wrote: > > I’m using Sybase where it doesn’t have deferred constraints and it seems > > like Cayenne is doing INSERTS first, but in my case, I w

RE: UUID as primary key >> class hierarchy persistence MappedSuperclass

2016-06-22 Thread Frederic Gilbart
Hi, Thank you Andrus for your answer. For my overview on Cayenne do you mean Cayenne cannot persists class hierarchy' properties ? How may I manage JPA @javax.persistence.MappedSuperclass in Cayenne ? Auditable is just an exemple to reproduce my case from a more complex project which ha

Re: Reverse engineering and dates

2016-06-22 Thread Anthony Giaccone
Yeah, I have an existing schema and it’s something of a mess, and were using git, so different branches have different schemas with different attributes. So I’m re-engineering a lot. I did what you suggested the first three times but then I was like. "Meh, there should be a better way….” M

Re: removeToManyTarget and delete from ObjectContext

2016-06-22 Thread Lon Varscsak
Ah, okay, gotcha. -Lon On Wed, Jun 22, 2016 at 6:50 AM, Michael Gentry wrote: > Hi Lon, > > Removing an object doesn't do a delete. You also have to do a > context.deleteObject(..) if you want to delete it. The reason is so that > you can do something like this: > > order = // some existing o

Re: Reverse engineering and dates

2016-06-22 Thread John Huss
If this is a one-time task, just open up the cayenne-*.map.xml file in a text editor and do a Find and Replace All of "java.util.Date" with "org.joda.time.DateTime". On Wed, Jun 22, 2016 at 11:06 AM Tony Giaccone wrote: > When reverse engineering a database, the java.util.Date class is used in

RE: Effective dated records

2016-06-22 Thread Meeks, Andrew
Thank you Hugi, Yes, that resolves my problem. This helps a lot! Andrew -Original Message- From: Hugi Thordarson [mailto:h...@karlmenn.is] Sent: Wednesday, June 22, 2016 11:54 AM To: user@cayenne.apache.org Subject: Re: Effective dated records Hi Andrew. If I understand your problem

Reverse engineering and dates

2016-06-22 Thread Tony Giaccone
When reverse engineering a database, the java.util.Date class is used in all the classes that reference timestamps. Is there a way to get this to default to another class? I'd like to use Joda's org.joda.time.DateTime instead. Is there an easy way to swap this out when the classes get generated?

Re: Effective dated records

2016-06-22 Thread Hugi Thordarson
Hi Andrew. If I understand your problem correctly you should be able to achieve this by setting a fetch limit of 1 on your query and sorting by date in descending order. It's the same as adding LIMIT to an SQL statement. For example, let’s assume you record the movement of paintings in an entity

Effective dated records

2016-06-22 Thread Meeks, Andrew
Is there a formal Cayenne approach to retrieving an effective dated record? At the moment my approach with SelectQuery is to request all records dated prior to a given date, then on the returned entities, loop through and find the most recent one. Alternatively, the correlated subquery could be

Re: removeToManyTarget and delete from ObjectContext

2016-06-22 Thread Michael Gentry
Hi Lon, Removing an object doesn't do a delete. You also have to do a context.deleteObject(..) if you want to delete it. The reason is so that you can do something like this: order = // some existing order order.removeFromUnfilledItems(item); order.addToFilledItems(item); context.commitChanges(