Hi,

At the risk of talking to myself, and being called mad I thought I'd report back on the following:

1. One way of doing what I described below is by using the fb:javascript binding.

I chucked the following:

<fb:javascript id="create_kw_rel" path="/">
 <fb:load-form>

 </fb:load-form>

<fb:save-form>
var programme_id = this.lookupWidget("programme_id").getValue()
var keyword_id = this.lookupWidget("new_keyword_id").getValue()
//create Hibernate session
var factory = cocoon.getComponent(Packages.hib.PersistenceFactory.ROLE);
var hs = factory.createSession();
if (hs == null) {
throw new Packages.org.apache.cocoon.ProcessingException("Hibernate session is null ");
}


var create_rel_bean = new Packages.nz.co.eunomia.KeywordRelationship(
new Packages.nz.co.eunomia.KeywordRelationshipPK(
new Packages.nz.co.eunomia.Keywords(new java.math.BigDecimal(keyword_id))
, new Packages.nz.co.eunomia.Programme(new java.math.BigDecimal(programme_id)
)
),
//obviously this shouldn't be hard coded - but for the purposes of testing it's fine.
new java.math.BigDecimal("4")
);



hs.save(create_rel_bean); hs.flush();

     //release
     hs.close();
     cocoon.releaseComponent(factory);
 </fb:save-form>
</fb:javascript>

into my binding document.

Now, this doesn't strike me as the cleanest thing in the world - does anyone have any comments or thoughts?

Thanks,

Corin


Corin Moss wrote:

Hi All,

I sent an email a few days ago asking for some advice on how to map a hibernate one-to-many relationship to cforms using the binding framework. My request may have been a bit vauge, as I haven't had any response yet. The original email can be seen here:
http://marc.theaimsgroup.com/?l=xml-cocoon-users&m=111214181513587&w=2


Since then, I've tested my understanding of the hibernate side of the question by doing the following in flowscript:

var create_rel_bean = new Packages.nz.co.eunomia.KeywordRelationship(
new Packages.nz.co.eunomia.KeywordRelationshipPK(
new Packages.nz.co.eunomia.Keywords(new java.math.BigDecimal("4"))
, new Packages.nz.co.eunomia.Programme(new java.math.BigDecimal("1")
)
),
new java.math.BigDecimal("4")
);


This creates a new keyword_relationship entry perfectly. Of course, the references to Keywords and Programme (with hard coded ids) is where the binding should be happening - as part of the context of (for example) a "Programme" bean. Given this, and the other material included above, is there a simple way to do this with binding, or should I rely on using flow-script and getting a handle on form values to do this?

Thanks,

Corin

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to