Manuel Mata wrote:
Hi i'm using cocoon with hibernate and flowscript/jx
just like hibernate tutorial in wiki. Everything works
fine but this.
I have a javascript function which takes an id
parameter
from the request and i need to recover the object with
hibernate API, but this code doesn't work.
function perfil_detail(){
openHibernateSession();
var id = Request.getParameter("id");
var perfil =
hs.load(Packages.mypackage.MyClass.class, new
java.lang.Long(id));
Instead you could also use
var perfil = hs.createQuery("mypackage.MyClass as myClass where id = " +
id).uniqueResult();
Note that in Java you would normally do something like
MyClass myClass = (MyClass) hs.createQuery("mypackage.MyClass as myClass
where id = " + id).uniqueResult();
This is required since createQuery returns an Object and not a MyClass.
This could mean that you would need another class that in turn would
query the database.
cocoon.sendPage(
"perfil.detail.display",
{perfil : perfil}
);
}
The hibernate Session.load takes a Class parameter
first so, how can i get that Class object in
flowscript?
I get this error:
org.mozilla.javascript.EcmaError: missing name after .
operator
SyntaxError -
file:/C:/cocoon-2.1.9/build/webapp/.../perfiles.js -
28:67
I searched on docs but dont find anything related to
this. Can anyone help ?
Thx in advance.
______________________________________________
LLama Gratis a cualquier PC del Mundo.
Llamadas a fijos y móviles desde 1 céntimo por minuto.
http://es.voice.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
Andre H. Juffer | Email: [EMAIL PROTECTED]
The Biocenter and | WWW: www.biochem.oulu.fi/Biocomputing/
the Dep. of Biochemistry | Fax: +358-8-553-1141
University of Oulu, Finland | Phone: +358-8-553 1161
Triacle Biocomputing | WWW: www.triacle-bc.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]