pg.ddx.io pgsql-jdbc@postgresql.org mailing list archive
help / color / mirror / Atom feedError with a hibernate query
2+ messages / 2 participants
[nested] [flat]
* Error with a hibernate query
@ 2005-04-15 00:16 Vernon <vwu725@yahoo.com>
0 siblings, 1 reply; 2+ messages in thread
From: Vernon @ 2005-04-15 00:16 UTC (permalink / raw)
To: pgsql-jdbc
The Java code:
public class User {
private Long id;
private String username;
private String password;
//...
}
The DB table:
create table USERS (
id SERIAL UNIQUE primary key,
username VARCHAR(80) NOT NULL,
password VARCHAR(80) NOT NULL,
...
);
The Hibernate query:
getHibernateTemplate().findByNamedParam("select u from
User as u where u.username=:username and
u.password=:password", new String[] { "username",
"password" }
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Error with a hibernate query
@ 2005-04-15 00:33 Dave Cramer <pg@fastcrypt.com>
parent: Vernon <vwu725@yahoo.com>
0 siblings, 0 replies; 2+ messages in thread
From: Dave Cramer @ 2005-04-15 00:33 UTC (permalink / raw)
To: Vernon <vwu725@yahoo.com>; +Cc: pgsql-jdbc
Do you have a hibernate mapping file ?
Dave
Vernon wrote:
>The Java code:
>
>public class User {
>
> private Long id;
> private String username;
> private String password;
>
> //...
>}
>
>The DB table:
>
>create table USERS (
> id SERIAL UNIQUE primary key,
> username VARCHAR(80) NOT NULL,
> password VARCHAR(80) NOT NULL,
> ...
>);
>
>The Hibernate query:
>
>getHibernateTemplate().findByNamedParam("select u from
> User as u where u.username=:username and
>u.password=:password", new String[] { "username",
>"password" }
>
>>From the stack, the following error seems to be on the
>JDBC driver side. Any suggestions of solving this
>problem?
>
>
>org.springframework.jdbc.BadSqlGrammarException: Bad
>SQL grammar [] in task 'Hibernate operation'; nested
>exception is java.sql.SQLException: ERROR: operator
>does not exist: character varying = bytea
>java.sql.SQLException: ERROR: operator does not exist:
>character varying = bytea
> at
>org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1365)
> at
>org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1160)
> at
>org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:172)
> at
>org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:387)
> at
>org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:328)
> at
>org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:238)
> at
>org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:92)
> at
>net.sf.hibernate.impl.BatcherImpl.getResultSet(BatcherImpl.java:88)
> at
>net.sf.hibernate.loader.Loader.getResultSet(Loader.java:875)
> at
>net.sf.hibernate.loader.Loader.doQuery(Loader.java:269)
> at
>net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:133)
> at
>net.sf.hibernate.loader.Loader.doList(Loader.java:1033)
> at
>net.sf.hibernate.loader.Loader.list(Loader.java:1024)
> at
>net.sf.hibernate.hql.QueryTranslator.list(QueryTranslator.java:854)
> at
>net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1553)
> at
>net.sf.hibernate.impl.QueryImpl.list(QueryImpl.java:39)
> at
>
>
>
>__________________________________
>Do you Yahoo!?
>Yahoo! Small Business - Try our new resources site!
>http://smallbusiness.yahoo.com/resources/
>
>---------------------------(end of broadcast)---------------------------
>TIP 4: Don't 'kill -9' the postmaster
>
>
>
>
--
Dave Cramer
http://www.postgresintl.com
519 939 0336
ICQ#14675561
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2005-04-15 00:33 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-04-15 00:16 Error with a hibernate query Vernon <vwu725@yahoo.com>
2005-04-15 00:33 ` Dave Cramer <pg@fastcrypt.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox