Re: Raw query

2017-05-05 Thread Amedeo Mantica
cool, thank you > On 1 May 2017, at 13:52, Michael Gentry wrote: > > Hi Amedeo, > > Another option for 3.1 is to use my AggregateUtils: > > https://github.com/mrg/cbe/tree/master/FetchingObjects/Aggregates/src/main/java/cbe/fetching/utilities > > (You'd need both of the files there.) > > Wit

Re: Duplicate pk when inserting into an empty table

2017-05-05 Thread Amedeo Mantica
Hi Pascal, May be related to an issue in pk generation in Cayenne 3.1.1 Could you try with 3.1.2 ? ( you have to compile it, let me know if you have issues ) https://github.com/apache/cayenne/pull/173 Friendly Amedeo > On 5 May 2017, at 16:10, Pascal Robert wrote: > > Hi, > > I’m using Cayen

Re: Duplicate pk when inserting into an empty table

2017-05-05 Thread Pascal Robert
Forget that email. I commented out two other calls to context.commitChanges() in another block, but I was still inserting objects. > Le 5 mai 2017 à 10:10, Pascal Robert a écrit : > > Hi, > > I’m using Cayenne 3.1.1 (moving from EOF) for a small project: migration data > from FileMaker to MyS

Duplicate pk when inserting into an empty table

2017-05-05 Thread Pascal Robert
Hi, I’m using Cayenne 3.1.1 (moving from EOF) for a small project: migration data from FileMaker to MySQL. I have one model with two data maps and two data nodes, one for FileMaker, the other for MySQL. Everything works fine, except one thing: java.sql.BatchUpdateException: Duplicate entry

Re: Read-only contexts?

2017-05-05 Thread Michael Gentry
Hi Alexander, Those are also good suggestions for implementing this feature. Thanks, mrg On Fri, May 5, 2017 at 9:19 AM, Alexander wrote: > Hi, > > thank you and Maik for answering so fast. You saved me a lot of time > searching around for nothing. > > Your suggestion seems to be the right a

Re: Read-only contexts?

2017-05-05 Thread Alexander
Hi, thank you and Maik for answering so fast. You saved me a lot of time searching around for nothing. Your suggestion seems to be the right approach. I’d consider making the read-only flag in the ObjectContext final, as to prevent unintended changes. Therefore it has to be set in the Object

Re: Read-only contexts?

2017-05-05 Thread Michael Gentry
#2 should've read: 2. Alter CayenneDataObject to check the entity's read-only status AND the context's read-only status. (Change writeProperty(), etc.) If either is read-only and you are trying to sneak a change in, throw an exception. mrg On Fri, May 5, 2017 at 7:04 AM, Michael Gentry wrote

Re: Read-only contexts?

2017-05-05 Thread Maik Musall
Hi Alexander, I suppose you could create your own ObjectContext subclass which does it, by overriding commitChanges() and related methods. I always recommend using custom subclasses of ObjectContext in any case, with a factory providing them, so you could always change the behaviour by extendin

Re: Read-only contexts?

2017-05-05 Thread Michael Gentry
Hi Alexander, I don't believe what you are asking for is currently doable, even in the latest 4.0 milestone release. An ObjectContext doesn't know anything about read-only. You can make a Cayenne object read-only in Cayenne Modeler, however this just omits setter-type methods. CayenneDataObject

Read-only contexts?

2017-05-05 Thread Alexander
Hi, I searched for a while, but wasn’t able to find a solution to make an ObjectContext “read-only”. Maybe I'm missing something. The point is: As suggested many times, there are situations where it makes sense to have a shared read-only ObjectContext and other ObjectContexts to commit c