Re: many-to-many mapping resulting in incomplete SQL queries

2008-05-12 Thread Daniel Doppmeier
You have a good point there. Thanks for the advice. I guess I would just have run into that problem later. Maybe it would be a good idea to add this advice to the user guide, where flattened relationships are discussed. It took me, as a cayenne beginner, some time to figure out how it is workin

Re: many-to-many mapping resulting in incomplete SQL queries

2008-05-12 Thread Michael Gentry
Daniel, I just re-ran your app after unchecking personID in your join table (only bookID was set as the primary key). That causes SQL like this to be produced: INFO: DELETE FROM Person_is_author_of_book WHERE bookID = ? May 12, 2008 2:45:31 PM org.apache.cayenne.access.QueryLogger logQueryParame

Re: many-to-many mapping resulting in incomplete SQL queries

2008-05-12 Thread Michael Gentry
Setting both as PK is more correct, though, from a DB-perspective. Your join table essentially has a compound primary key. I'd define it that way in the DB, too. Setting both columns to be PK (it'll help for the index, too). Glad to hear it is working for you now. /dev/mrg On Mon, May 12, 200

Re: many-to-many mapping resulting in incomplete SQL queries

2008-05-12 Thread Daniel Doppmeier
Hi Thanks again. Setting at least one of the attributes as primary key solved the problem. As far as I tested, it is not important which of the attributes is assigned the primary key, but there has to be at least one PK. The PK generation strategy is set to default by the modeller. Any change

Re: many-to-many mapping resulting in incomplete SQL queries

2008-05-12 Thread Michael Gentry
[followup back to the user list] Hi Daniel, The first time I ran your test application it did indeed crash with the missing WHERE clause (this is on Cayenne 3.x, too). I went into your Cayenne Model, though, and on your Person_is_author_of_book table (you didn't map it as a class, which is cool

Re: many-to-many mapping resulting in incomplete SQL queries

2008-05-12 Thread Michael Gentry
Hi Dan, I don't see anything offhand. Since you said you created a simple test application, could you send it to me and I'll take a look at it? Just tar it up and send directly to me (the mailing list doesn't support attachments). Be sure to sanitize the DB connection information first, though.

Re: many-to-many mapping resulting in incomplete SQL queries

2008-05-09 Thread Daniel Doppmeier
Hi! I'm sorry I made a mistake there. When I was posting the code I was leaving out some lines of comment and I seem to have lost one line of code meanwhile. So here is the (slightly changed) code again. This time free of typing errors, I hope: DataContext context = DataContext.creat

Re: many-to-many mapping resulting in incomplete SQL queries

2008-05-09 Thread Michael Gentry
Hi Daniel, I'm not sure if you've solved your problem yet, but from the code you posted, I don't see where you established any relationship between book1 and author1/author2. You had objects with no relationship defined, so you can't actually remove book1 from author1. /dev/mrg On Tue, May 6, 2

many-to-many mapping resulting in incomplete SQL queries

2008-05-06 Thread Daniel Doppmeier
Hello everyone! I am new to cayenne and experiencing some problems, when modelling a many-to-many relationship. After I could not solve the problem for an application I am writing at the moment, I set up the following example application, which is producing the same problems: I modelled a sm