Raul Raja Martinez,

  That worked... Thanks.

The Hibernate SQL I wrote did not. I modified it some but that is not going so 
well.

Unable to resolve expression 'userName' for [EMAIL PROTECTED]
binding:        ExpressionBinding[Login userName]
location:       context:/Login.html, line 18
 
ognl.OgnlException
userName
 
java.lang.NullPointerException
Stack Trace:
    * 
com.entercite.finance.model.abstrt.LoginComponent.getUserName(LoginComponent.java:25)
    * sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    * sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    * sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 

Turning on the SQL output I also get this:

Hibernate: select login0_.id as id, login0_.user_id as user2_0_, 
login0_.user_name as user3_0_, login0_.password as pass
word0_, login0_.permission_type as permission5_0_, login0_.insert_date as 
insert6_0_, login0_.modify_date as modify7_0_
from login login0_ where login0_.user_name=? and login0_.password=?

    protected Object find(Class clazz, String value1, String value2){

        Object obj = null;
        try {
            startOperation();

            Query query = session.createQuery(
                "from " + clazz.getName() +
                " where userName = ? and password = ?");
            query.setParameter(0, value1, Hibernate.STRING);
            query.setParameter(1, value2, Hibernate.STRING);

            obj = query.uniqueResult();
            tx.commit();

        } catch (HibernateException e) {
            handleException(e);
        } finally {
            HibernateFactory.close(session);
        }

        return obj;

    }

Do I have to write the SQL more like this example:

Query q = s.createQuery("from foo in class Foo where foo.name=:name and 
foo.size=:size");
q.setProperties(fooBean); // fooBean has getName() and getSize()
List foos = q.list();

-- 
___________________________________________________
Play 100s of games for FREE! http://games.mail.com/


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

Reply via email to