MySQL, DbGenerator and auto_increment

2008-07-15 Thread Borut BolĨina
Hello, is it possible to generate AUTO_INCREMENT with MySQLDbAdapter when running DbGenerator via API? The goal is to use auto_increment instead of AUTO_PK_SUPPORT table. Regards, Borut

RE: What to do with new objects if validation fails on Commit

2008-07-15 Thread Fredrik Liden
Hi, every time you do context.commit(); you should probably have context.rollbackChanges(); in the catch statement to set it back to the original state and avoid the same validation error on every consecutive commit. And possibly forward the validation error to the user in some form. Fredrik -

Re: Unique persistent object and caching issue

2008-07-15 Thread Andrus Adamchik
Cool! Glad to hear that helped... Issues resulting from users forgetting to check "To Dep PK" come up pretty often. I wonder if we can make Cayenne smarter in the backend to at least report potential problems as a modeler warning or something. Andrus On Jul 15, 2008, at 8:27 PM, Laurent Ma

What to do with new objects if validation fails on Commit

2008-07-15 Thread Devyandu
I am new to Cayenne but enjoying using it, I have a question about what to do with new or modified objects when a validation failure or runtime exception happens on Commit. This is my Environment TomCat 5.0 Java 1.4.2 Cayenne 2.0.4 Struts For example in my save new painting Actionclass DataConte

Re: Unique persistent object and caching issue

2008-07-15 Thread Laurent Marchal
Nice this solve the problem ! Sorry to bother you with that, and thanks a lot. It's a little bit complicated to understand what do Cayenne internally, but luckylly you were there. Laurent. Andrus Adamchik wrote: Could you check the "To Dep PK" checkbox for this relationship and see if that m

Re: Unique persistent object and caching issue

2008-07-15 Thread Andrus Adamchik
Could you check the "To Dep PK" checkbox for this relationship and see if that makes a difference. Andrus On Jul 15, 2008, at 6:43 PM, Laurent Marchal wrote: target="SNAME_AUX" toMany="true">

Re: Unique persistent object and caching issue

2008-07-15 Thread Laurent Marchal
Sorry forgot to say I use 3.0M4 !

Re: Unique persistent object and caching issue

2008-07-15 Thread Laurent Marchal
Ok thanks to help me : ## ## Query ## MasterSchedule.getById(...) ## ## CODE ## public static MasterSchedule getById(ObjectContext context, Integer skdId) throws OpconException { List skdList = MasterSchedule.getByExpression(context, ExpressionFactory.matchExp( Mast

Re: Unique persistent object and caching issue

2008-07-15 Thread Andrus Adamchik
On Jul 15, 2008, at 6:10 PM, Laurent Marchal wrote: In fact it does a little because the Artist_AUX list is well in sync with the database. But now each time i use the Artist object Cayenne do 1 request for each related Artist_AUX row ! That was the thing i wanted to avoid This is str

Re: Unique persistent object and caching issue

2008-07-15 Thread Laurent Marchal
the query.addPrefetch("relatedArtistAux") does not work for me ! In fact it does a little because the Artist_AUX list is well in sync with the database. But now each time i use the Artist object Cayenne do 1 request for each related Artist_AUX row ! That was the thing i wanted to avoid I

Re: Unique persistent object and caching issue

2008-07-15 Thread Andrus Adamchik
On Jul 15, 2008, at 4:49 PM, Laurent Marchal wrote: But the thing I don't understand is why when i refetch the Artist object the relationships are not invalidated. By default only the object itself is refreshed. Cayenne has no way of knowing which part of the object graph has changed, so t

Re: Unique persistent object and caching issue

2008-07-15 Thread Laurent Marchal
Thanks Andrus, i have tried and Cayenne alone works well : I don't see one request per access. I have one-to-many relationship between Artist and Artist_AUX called "getRelatedArtistAux()" but the problem is as soon i delete one of this Artist_AUX row, the Artist relationships are not refreshed

Re: Unique persistent object and caching issue

2008-07-15 Thread Andrus Adamchik
Hi, If I understand correctly your setup, you can map a one-to-many relationship between Artist and Artist_AUX and let Cayenne handle faulting automatically behind the scenes. Andrus On Jul 15, 2008, at 3:25 PM, Laurent Marchal wrote: Hi all, I have a problem that i cannot solve. My

Unique persistent object and caching issue

2008-07-15 Thread Laurent Marchal
Hi all, I have a problem that i cannot solve. My customer has a strange database schema : each table has a related "AUX" table where extended properties are stored in rows. For example .--. | Artist | ++-+ | Id | Name| +-