Il giorno 29/nov/04, alle 20:58, Laurent Perez ha scritto:

I'm trying to access a very simple sql table within a flowscript,
using Hibernate. I've read wiki docs but I'm stuck. The hbm.xml and
User.class files are fine, here's my sample function :

function addUser() {
var user = new Packages.company.pojo.User();
user.setName("john");
user.setAge(12);
cocoon.sendPage("addSuccess"); // matched in sitemap
}

I have a pipeline pattern matcher calling "addUser", the flowscript
runs without errors, but the user isn't inserted. I must be missing
something simple (like user.save() or smth) to get this to work, but I
don't see exactly what.

My advice would be to read the Hibernate docs carefully. You should create a Hibernate session and save your object using the Session.save method. This has nothing to do with flowscript or Cocoon, but is just basic Hibernate knowledge.


Also, a Spring environment is available on my server, and I know I can declare Hibernate beans within applicationContext-hibernate.xml file, however I do not understand how to load and access the 'Spring'd' bean from a flowscript either :(

A full sample application using Spring and Hibernate from the flowscript is available here: http://new.cocoondev.org/main/projects/43

        Ugo

--
Ugo Cei - http://beblogging.com/

Attachment: smime.p7s
Description: S/MIME cryptographic signature



Reply via email to