You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Corin Moss <co...@infomoss.com> on 2005/03/30 02:17:30 UTC

Cforms - binding a one-to-many relationship with hibernate

Hi there,

I'm looking at the Hibernate / CForms combination for the first time.  
I've successfully bound forms to beans to Hibernate for fairly simple 
cases (modifying a flat record for example.)  I now have a slightly more 
complicated example:

-A record exists in table "programme" with a one-to-many relationship 
with table "keyword_relationship" (based on programme's programme_id)
-"keyword_relationship" has a many-to-one relationship with table 
"keywords" (based on keyword's keyword_id)

I would like to creating a binding so that a new bean can be inserted 
representing a "keyword_relationship" record, but from the "programme" 
bean context.  Obviously the "keyword" bean would exist already, as 
would the "programme" bean.

I've got no problems traversing the graph so that I can display (and 
persist) "keyword" records as related to specific "programme" records - 
it's purely creating new "keyword_relationship" records that is proving 
problematic.

Can anyone direct me to any example of this happening? I've looked 
through the super-sonic tour block, but haven't been able to unearth 
anything.  I've attached my Hibernate binding files for reference 
(generated using Hibernate Synchronizer in Eclipse.)

Thanks for your help,

Corin