Hi Andre,
you cannot actually access the bean from the template, since the template does not even know that there is a binding and a bean. Anyway, you can pass the bean (and the session, and everything else you need) from the flow to the (JX) template passing it as a bizdata, for example :

in flow :

form.showForm('myform.def.xml', {"bean": mybaean});

in jx template you can then access the bean with ${bean.method()}.

The flow/view/hibernate problem is commonly not easy to solve, there has been a recent thread about this : http://marc.theaimsgroup.com/?l=xml-cocoon-users&m=114164895800296&w=2 . In the second mail of this thread i posted a possible solution we are using in our cocoon+hibernate+spring projects.

Hope this helps,
Simone

Andre Cesta wrote:

How do I access the BEAN itself that is bound on CFORMS with bean binding 
framework?

To be more specific, how to I access/reference the bean from: 1.Inside the 
cform template file and
2 . Inside the cform binding file?

I was trying to do the following from the form template:
<jx:set var="hibsession" value="${services.HibernateSession.current()}" />
<jx:set var="lockedobj" value="${hibsession.lock(.)}" />
Although the form displays, the code seems to fail to execute.

Doing the following:

 <p><jx:out value="#{.}" /> </p>

Does display: [object Object]
But the problem is that I cannot seem to be able to call methods on it.

I explain what I want to achieve with this:

I want to be able to reattach an object to a new hibernate session on the view 
(template).

Normally the pattern used with hibernate lazy initialized objects and CForms is 
the: “session
closed on view pattern”.  This means the session is passed/stored on the 
“request header” and will
be closed normally by a servlet filter on the view. Examples of this can be 
found on the cocoon
mailing list, and also on the “Hibernate Fast” book and on the Cocoon wiki for 
hibernate.

The problem with this is that it moves a lot of the code that has to do with 
transactions,
sessions from Java into Cocoon.

The “hibernate in action” book mentions that a good alternative to keeping the 
session open is to
simply leave your Java methods as they are (closing the sessions) and reopen 
the sessions on the
view and reattaching the objects (lock method).

I wonder if anybody would be able to help me achieving this reopening and 
reattachment of the
session.

Has anybody perhaps already tried this?  Are you satisfied with the results?



                
___________________________________________________________ To help you stay safe and secure online, we've developed the all new Yahoo! Security Centre. http://uk.security.yahoo.com

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

--
Simone Gianni

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

Reply via email to