These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: problem with postgres
PostPosted: Thu Sep 09, 2004 9:14 am 
Newbie

Joined: Thu Sep 09, 2004 9:01 am
Posts: 3
Hi people, I was using hibernate 2.1.4 with MySQL and i had no problems. But, i decided to do tests with another DB(postgres 7.4.1) and i got some errors.

Here is my hibernate-mapping:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 2.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class name="Usuarios" table="usuarios">
<id name="codigo" column="codigo" type="java.lang.Integer">
<generator class="sequence"/>
</id>
<property name="nome" type="string"/>
<property name="idade" type="string"/>
<property name="email" type="string"/>
<property name="senha" type="string"/>
<property name="endereco" type="string"/>
<property name="cidade" type="string"/>
<property name="estado" type="string"/>
<property name="cep" type="string"/>
<property name="dt_inc" type="date"/>
<property name="hr_inc" type="string"/>
<property name="user_inc" type="int"/>
<property name="dt_alt" type="date"/>
<property name="hr_alt" type="string"/>
<property name="user_alt" type="int"/>
<property name="situation" type="char"/>
</class>
</hibernate-mapping>


My Code between sessionFactory.openSession() and session.close():

public java.util.List getAut(String condicao, Object obj, Object obj2,NullableType tipo,NullableType tipo2) throws Exception{
Session session = factory.openSession();
Query q = session.createQuery(condicao);
q.setParameter("param",obj);
q.setParameter("param2",obj2);
java.util.List lista_usuarios = q.list();
session.flush();
session.close();
return lista_usuarios;
}

The Full stack trace of exceptions:

2004-09-09 09:19:03,796 DEBUG hibernate.impl.BatcherImpl -> preparing statement
2004-09-09 09:19:03,803 DEBUG hibernate.util.JDBCExceptionReporter -> SQL Exception
org.postgresql.util.PSQLException: ERROR: relation "usuarios" does not exist

at org.postgresql.util.PSQLException.parseServerError(PSQLException.java:139)
at org.postgresql.core.QueryExecutor.executeV3(QueryExecutor.java:152)
at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:100)
at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:43)
at org.postgresql.jdbc1.AbstractJdbc1Statement.execute(AbstractJdbc1Statement.java:517)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:50)
at org.postgresql.jdbc1.AbstractJdbc1Statement.executeQuery(AbstractJdbc1Statement.java:233)
at net.sf.hibernate.impl.BatcherImpl.getResultSet(BatcherImpl.java:87)
at net.sf.hibernate.loader.Loader.getResultSet(Loader.java:800)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:189)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:133)
at net.sf.hibernate.loader.Loader.doList(Loader.java:955)
at net.sf.hibernate.loader.Loader.list(Loader.java:946)
at net.sf.hibernate.hql.QueryTranslator.list(QueryTranslator.java:846)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1543)
at net.sf.hibernate.impl.QueryImpl.list(QueryImpl.java:39)
at UsuariosDAO.getCompleteList(UsuariosDAO.java:44)
at LeitorCadastro.persiste_usuario(LeitorCadastro.java:213)
at LeitorCadastro.percorrerArvore(LeitorCadastro.java:59)
at LeitorCadastro.percorrerArvore(LeitorCadastro.java:67)
at LeitorCadastro.<init>(LeitorCadastro.java:37)
at ServerHandler.receiveFile(ServerHandler.java:33)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.xmlrpc.Invoker.execute(Invoker.java:168)
at org.apache.xmlrpc.XmlRpcWorker.invokeHandler(XmlRpcWorker.java:123)
at org.apache.xmlrpc.XmlRpcWorker.execute(XmlRpcWorker.java:185)
at org.apache.xmlrpc.XmlRpcServer.execute(XmlRpcServer.java:151)
at org.apache.xmlrpc.XmlRpcServer.execute(XmlRpcServer.java:139)
at org.apache.xmlrpc.WebServer$Connection.run(WebServer.java:773)
at org.apache.xmlrpc.WebServer$Runner.run(WebServer.java:656)
at java.lang.Thread.run(Thread.java:534)
2004-09-09 09:19:03,980 WARN hibernate.util.JDBCExceptionReporter -> SQL Error: 0, SQLState: 42P01
2004-09-09 09:19:03,981 ERROR hibernate.util.JDBCExceptionReporter -> ERROR: relation "usuarios" does not exist

2004-09-09 09:19:03,981 DEBUG hibernate.impl.BatcherImpl -> done closing: 0 open PreparedStatements, 0 open ResultSets
2004-09-09 09:19:03,981 DEBUG hibernate.impl.BatcherImpl -> closing statement
2004-09-09 09:19:03,982 DEBUG hibernate.util.JDBCExceptionReporter -> SQL Exception
org.postgresql.util.PSQLException: ERROR: relation "usuarios" does not exist

at org.postgresql.util.PSQLException.parseServerError(PSQLException.java:139)
at org.postgresql.core.QueryExecutor.executeV3(QueryExecutor.java:152)
at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:100)
at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:43)
at org.postgresql.jdbc1.AbstractJdbc1Statement.execute(AbstractJdbc1Statement.java:517)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:50)
at org.postgresql.jdbc1.AbstractJdbc1Statement.executeQuery(AbstractJdbc1Statement.java:233)
at net.sf.hibernate.impl.BatcherImpl.getResultSet(BatcherImpl.java:87)
at net.sf.hibernate.loader.Loader.getResultSet(Loader.java:800)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:189)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:133)
at net.sf.hibernate.loader.Loader.doList(Loader.java:955)
at net.sf.hibernate.loader.Loader.list(Loader.java:946)
at net.sf.hibernate.hql.QueryTranslator.list(QueryTranslator.java:846)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1543)
at net.sf.hibernate.impl.QueryImpl.list(QueryImpl.java:39)
at UsuariosDAO.getCompleteList(UsuariosDAO.java:44)
at LeitorCadastro.persiste_usuario(LeitorCadastro.java:213)
at LeitorCadastro.percorrerArvore(LeitorCadastro.java:59)
at LeitorCadastro.percorrerArvore(LeitorCadastro.java:67)
at LeitorCadastro.<init>(LeitorCadastro.java:37)
at ServerHandler.receiveFile(ServerHandler.java:33)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.xmlrpc.Invoker.execute(Invoker.java:168)
at org.apache.xmlrpc.XmlRpcWorker.invokeHandler(XmlRpcWorker.java:123)
at org.apache.xmlrpc.XmlRpcWorker.execute(XmlRpcWorker.java:185)
at org.apache.xmlrpc.XmlRpcServer.execute(XmlRpcServer.java:151)
at org.apache.xmlrpc.XmlRpcServer.execute(XmlRpcServer.java:139)
at org.apache.xmlrpc.WebServer$Connection.run(WebServer.java:773)
at org.apache.xmlrpc.WebServer$Runner.run(WebServer.java:656)
at java.lang.Thread.run(Thread.java:534)
2004-09-09 09:19:03,986 WARN hibernate.util.JDBCExceptionReporter -> SQL Error: 0, SQLState: 42P01
2004-09-09 09:19:03,986 ERROR hibernate.util.JDBCExceptionReporter -> ERROR: relation "usuarios" does not exist

2004-09-09 09:19:03,987 ERROR hibernate.util.JDBCExceptionReporter -> Could not execute query
org.postgresql.util.PSQLException: ERROR: relation "usuarios" does not exist

at org.postgresql.util.PSQLException.parseServerError(PSQLException.java:139)
at org.postgresql.core.QueryExecutor.executeV3(QueryExecutor.java:152)
at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:100)
at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:43)
at org.postgresql.jdbc1.AbstractJdbc1Statement.execute(AbstractJdbc1Statement.java:517)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:50)
at org.postgresql.jdbc1.AbstractJdbc1Statement.executeQuery(AbstractJdbc1Statement.java:233)
at net.sf.hibernate.impl.BatcherImpl.getResultSet(BatcherImpl.java:87)
at net.sf.hibernate.loader.Loader.getResultSet(Loader.java:800)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:189)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:133)
at net.sf.hibernate.loader.Loader.doList(Loader.java:955)
at net.sf.hibernate.loader.Loader.list(Loader.java:946)
at net.sf.hibernate.hql.QueryTranslator.list(QueryTranslator.java:846)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1543)
at net.sf.hibernate.impl.QueryImpl.list(QueryImpl.java:39)
at UsuariosDAO.getCompleteList(UsuariosDAO.java:44)
at LeitorCadastro.persiste_usuario(LeitorCadastro.java:213)
at LeitorCadastro.percorrerArvore(LeitorCadastro.java:59)
at LeitorCadastro.percorrerArvore(LeitorCadastro.java:67)
at LeitorCadastro.<init>(LeitorCadastro.java:37)
at ServerHandler.receiveFile(ServerHandler.java:33)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.xmlrpc.Invoker.execute(Invoker.java:168)
at org.apache.xmlrpc.XmlRpcWorker.invokeHandler(XmlRpcWorker.java:123)
at org.apache.xmlrpc.XmlRpcWorker.execute(XmlRpcWorker.java:185)
at org.apache.xmlrpc.XmlRpcServer.execute(XmlRpcServer.java:151)
at org.apache.xmlrpc.XmlRpcServer.execute(XmlRpcServer.java:139)
at org.apache.xmlrpc.WebServer$Connection.run(WebServer.java:773)
at org.apache.xmlrpc.WebServer$Runner.run(WebServer.java:656)
at java.lang.Thread.run(Thread.java:534)
Erro na leitura do XML: net.sf.hibernate.JDBCException: Could not execute query


Name and version of the database:

PostgreSQL 7.4.1

May someone help me?

Anselmo


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 09, 2004 1:01 pm 
Newbie

Joined: Thu Sep 09, 2004 9:01 am
Posts: 3
Well, i discovered the orign of the error, and i note that there is a problem with the use of "like" in my select queries. Someone have an ideia how use "like" in hibernate 2.1.4 with postgres 7.4.1?

Thanks,

Anselmo


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.