Quoting 9902468 <[EMAIL PROTECTED]>:

Check that the

@Inject
private Session session;

session is org.hibernate.Session.

- 99




It is. I notice that when I switch on the mysql log that no attempt is ever made to access the db. Is there any kind of logging I can switch on from Tapestry (or maybe Hibernate) to tell me what is going on? (I am quite sure the xml file is correct and in the classpath, so I am running out of ideas! Although it must be something simple as
these things usually are). session is always null when this code is run.

Code and XML below:


package uk.bl.dlportal.pages.util;

import java.util.List;

import org.apache.tapestry5.ioc.annotations.Inject;
import org.hibernate.Query;
import org.hibernate.Session;

import uk.bl.dlportal.entities.User;


public class Security
{
        @Inject
        private Session session;

        private final static Security security = new Security();


        public User authenticate(String userName, String password)
        {
System.out.println("SESSION ************************ "+session);

                List result = session.createCriteria(User.class).list();

                return null;
        }

        public static Security getSecurity()
        {
                return security;
        }
}



XML hibernate.cfg.xml is in src/main/resources:

<!DOCTYPE hibernate-configuration PUBLIC
        "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
        "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd";>
<hibernate-configuration>
    <session-factory>
        <property
name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
        <property
name="hibernate.connection.url">jdbc:mysql://localhost:3306/dlportal</property>
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
        <property name="hibernate.connection.username">root</property>
        <property name="hibernate.connection.password">admin</property>
        <property name="hbm2ddl.auto">update</property>
        <property name="hibernate.show_sql">true</property>
        <property name="hibernate.format_sql">true</property>
    </session-factory>
</hibernate-configuration>


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

Reply via email to