You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Nishant Neeraj <nn...@yahoo.com> on 2009/08/22 23:41:26 UTC

many-to-many relationship does not work in Cayenne.

Hi, 

I have been trying to get a demo with Cayenne. Looks like
Cayenne does not like the schema the DAOs created are a mess. They have
texts like $importUtils.addType(${rel.TargetEntity.ClientClassName})
where you expect a method paramter.

I was creating the following relation-ship for a magzine-subscriber management.

(category) -|----(one to many)----<  (magazines)
(magazines) -|----(one to many)----<  (magazine_issues)
(magazine_issues) >----(many to one)----|-  (subscribers)

basically,
magazine_issues stores the information that which magazine is assigned
to which subscriber. so, everytime a order for a magazine comes there
is a row created in magazine_issues table.

The relationship that I have added in modeler is

category to magazine To Dep PK (checked), to many
 (checked)

magazine to category To Dep PK (un-checked), to many (un-checked)
magazine to magazine_issues To Dep PK (checked), to many (checked)

magazine_issue to magazine To Dep PK (un-checked), to many (un-checked)
magazine_issues to subscribers To Dep PK (un-checked), to many (un-checked)

subscribers to magazine_issues To Dep PK (checked), to many (checked)

--------

with
these setting now when I try to create DAOs I get lot of placeholder
sort of code like
$importUtils.addType(${rel.TargetEntity.ClientClassName})

Can anyone explain me what I am doing wrong here?

Thanks 
Nishant


      Love Cricket? Check out live scores, photos, video highlights and more. Click here http://cricket.yahoo.com

Re: many-to-many relationship does not work in Cayenne.

Posted by Aristedes Maniatis <ar...@maniatis.org>.
On 23/08/09 7:41 AM, Nishant Neeraj wrote:
> I have been trying to get a demo with Cayenne. Looks like
> Cayenne does not like the schema the DAOs created are a mess. They have
> texts like $importUtils.addType(${rel.TargetEntity.ClientClassName})
> where you expect a method paramter.

Review the steps in the tutorial with regard to cgen (if you are using ant/maven) [1] or using the modeler to generate the entity classes. Yours are the raw templates without having velocity transform them into the final files. Make sure you have the velocity jar in your classpath.

Ari Maniatis


[1] http://cayenne.apache.org/doc/cgen.html

-------------------------->
Aristedes Maniatis
GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A