Hi,
I have, for the first time, installed hibernate and followed instructions I managed to get concerning hibernate and cocoon, and of course it doesn't work! When you run the pipeline:


<map:pipelines>

      <map:pipeline>
                                <map:match pattern="test">
                                        <map:generate type="serverpages" 
src="test.xml"/>
                                        <map:serialize/>
                                </map:match>
            </map:pipeline>

</map:pipelines>


, string s is written to the page sucessfully but nothing is written to my postgresql database table test. I do not get an error message either. What am I doing wrong????


I have the following file, test.xml:

<xsp:page language="java" xmlns:xsp="http://apache.org/xsp";>
  <xsp:structure>
   <xsp:include>test.User</xsp:include>
  </xsp:structure>
  <page>
    <title>Hello</title>
    <content>
                        <xsp:logic>
                                 User  usr = new User();
                                 usr.setID("51");
                                 usr.setUserName("beyanet");
                                 usr.setPassword("xyz");
                                 usr.setEmailAddress("[EMAIL PROTECTED]");
                                
                                 usr.add();             
                                 String  s = usr.getUserName();
                        </xsp:logic>

      <xsp:expr>s</xsp:expr>
    </content>
  </page>
</xsp:page>

The User.class file is as so:

package test;

import java.util.*;
import net.sf.hibernate.*;
import net.sf.hibernate.cfg.*;


public class User{


        private String userID;
        private String userName;
        private String password;
        private String emailAddress;
        private Date lastLogon;

        public String getID() {
                return userID;
        }
        public void setID(String newUserID) {
                userID = newUserID;
        }

    public String getUserName() {
        return (userName == null ? "" : userName);
    }
    public void setUserName(String userName) {
        this.userName = userName;
    }

     public String getPassword() {
         return (password == null ? "" : password);
     }
     public void setPassword(String password) {
         this.password = password;
     }

    public String getEmailAddress() {
        return emailAddress;
    }
    public void setEmailAddress(String emailAddress) {
        this.emailAddress = emailAddress;
    }

        public Date getLastLogon() {
                return lastLogon;
        }
    public void setLastLogon(Date newLastLogon) {
                lastLogon = newLastLogon;
        }

     public void add() {
        try {
            Configuration cfg = new Configuration();
            cfg.addClass(test.User.class);
            SessionFactory sf = cfg.buildSessionFactory();
            Session hs = sf.openSession();
            hs.save(this);

hs.flush();

            hs.close();
            hs = null;

            sf.close();
            sf = null;

cfg = null;
}
catch ( Exception e) {
System.out.println("Exception in Hibernate:" + e.getMessage());
}


    }
    public String test() {
        return "OK";
    }
}

Andrew


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



Reply via email to