Mikee805 wrote:
I figured it out thanks for the help. It was just a dumb mistake on my part.
Hibernate 3.1.3
Mysql 4.1.2
Linux 2.6.12
I haven't been so lucky... I have yet to find my dumb mistake...
---
The code:
StringBuffer hql = new StringBuffer( "from mycompany.domain.pojo.Account ");
hql.append( "a where a.username=:username" );
Query query = session.createQuery( hql.toString() );
query.setString( "username", username );
Account acct = (Account) query.uniqueResult();
return ( acct );
(and I've traced the code to see that 'username' is, in fact, set properly)
---
show_sql gives this:
select account0_.id as id54_, account0_.version as version54_, account0_.username as username54_, account0_.password as password54_, account0_.person_id as person5_54_ from account account0_ where account0_.username=?
---
Pasting that into mysql command line with the ? replaced with a valid 'username' works:
mysql> select account0_.id as id54_, account0_.version as version54_, account0_.username as username54_, account0_.password as password54_, account0_.person_id as person5_54_ from account account0_ where account0_.username="admin";
+-------+------------+-------------+------------------+-------------+
| id54_ | version54_ | username54_ | password54_ | person5_54_ |
+-------+------------+-------------+------------------+-------------+
| 1 | 0 | admin | 43e9a4ab75570f5b | 1 |
+-------+------------+-------------+------------------+-------------+
1 row in set (0.00 sec)
---
But I get 0 rows back from hibernate...
Is it possible to do something like 'show_sql' that will show the sql *after* the parameters have been substituted?
Thanks
M.