Erro ao executar function no Hibernate3 com Hibernate Tools

Pessoal,
Gostaria de saber se alguem já conseguiu executar function no hibernate 3.0. Utilizei a Hibernate Tools para gerar os hbm.xml e suas respectivas classes.

pessoa.hbm.xml ( xml criado pelo Hibernate Tools)

// coloquei para executar a store procedure

// esta tbem coloquei para gerar a store procedure


{? = call TESTE1}


function do banco postgres 8.1
CREATE FUNCTION TESTE1() RETURNs text AS
‘SELECT NOME FROM PESSOA WHERE CPF = 1’
LANGUAGE SQL;

O DAO gerado pelo hibernate tools.

public class PessoaHome {

private static final Log log = LogFactory.getLog(PessoaHome.class);

private SessionFactory sessionFactory;
private Session session;
private Transaction tx;

private SessionFactory getSessao() {
return this.sessionFactory;
}

public PessoaHome()throws Exception{
Configuration cfg = new Configuration();
cfg.addResource(“hibernate.cfg.xml”);
this.sessionFactory = cfg.addClass(br.com.Pessoa.class).buildSessionFactory();
}

private void ChecaSession() {
if (!(session instanceof Session)) {
this.session = getSessao().openSession();
}
else if(!(session.isConnected())) {
session.connection();
}
}

public Pessoa FucTeste(){
log.debug(“persisting FucTeste”);
try {
ChecaSession();
tx = session.beginTransaction();
Pessoa p = (Pessoa) session.getNamedQuery(“TESTE1”);
log.debug(“persist successful”);
tx.commit();
return p;
}
catch (RuntimeException re) {
log.error(“persist failed”, re);
throw re;
}
}

}

Classe para testar:

public class TestePessoaFunc {
public static void main(String[] args){
try {
PessoaHome ps = new PessoaHome();
Pessoa x = ps.FucTeste();
System.out.println(“PEssoa Teste Fuction[” + x.getNome() + “]”);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}

Erro reportado ao executar:

2006-04-17 21:06:14,921 INFO - Hibernate 3.1.3 - [org.hibernate.cfg.Environment]
2006-04-17 21:06:14,921 INFO - loaded properties from resource hibernate.properties: {hibernate.connection.username=W5G00A, hibernate.connection.password=****, hibernate.cglib.use_reflection_optimizer=true, hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect, hibernate.connection.url=jdbc:postgresql://localhost:5432/hibernate, hibernate.connection.driver_class=org.postgresql.Driver} - [org.hibernate.cfg.Environment]
2006-04-17 21:06:14,921 INFO - using CGLIB reflection optimizer - [org.hibernate.cfg.Environment]
2006-04-17 21:06:14,921 INFO - using JDK 1.4 java.sql.Timestamp handling - [org.hibernate.cfg.Environment]
2006-04-17 21:06:15,000 INFO - Reading mappings from resource: hibernate.cfg.xml - [org.hibernate.cfg.Configuration]
2006-04-17 21:06:15,062 DEBUG - trying to resolve system-id [http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd] - [org.hibernate.util.DTDEntityResolver]
2006-04-17 21:06:15,062 DEBUG - recognized hibernate namespace; attempting to resolve on classpath under org/hibernate/ - [org.hibernate.util.DTDEntityResolver]
2006-04-17 21:06:15,078 DEBUG - located [http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd] in classpath - [org.hibernate.util.DTDEntityResolver]
2006-04-17 21:06:15,156 INFO - Reading mappings from resource: br/com/Pessoa.hbm.xml - [org.hibernate.cfg.Configuration]
2006-04-17 21:06:15,156 DEBUG - trying to resolve system-id [http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd] - [org.hibernate.util.DTDEntityResolver]
2006-04-17 21:06:15,156 DEBUG - recognized hibernate namespace; attempting to resolve on classpath under org/hibernate/ - [org.hibernate.util.DTDEntityResolver]
2006-04-17 21:06:15,156 DEBUG - located [http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd] in classpath - [org.hibernate.util.DTDEntityResolver]
2006-04-17 21:06:15,234 INFO - Mapping class: br.com.Pessoa -> pessoa - [org.hibernate.cfg.HbmBinder]
2006-04-17 21:06:15,234 DEBUG - Mapped property: cpf -> cpf - [org.hibernate.cfg.HbmBinder]
2006-04-17 21:06:15,250 DEBUG - Mapped property: nome -> nome - [org.hibernate.cfg.HbmBinder]
2006-04-17 21:06:15,250 DEBUG - Mapped property: dtnascimento -> dtnascimento - [org.hibernate.cfg.HbmBinder]
2006-04-17 21:06:15,250 DEBUG - Preparing to build session factory with filters : {} - [org.hibernate.cfg.Configuration]
2006-04-17 21:06:15,250 DEBUG - processing extends queue - [org.hibernate.cfg.Configuration]
2006-04-17 21:06:15,250 DEBUG - processing collection mappings - [org.hibernate.cfg.Configuration]
2006-04-17 21:06:15,250 DEBUG - processing native query and ResultSetMapping mappings - [org.hibernate.cfg.Configuration]
2006-04-17 21:06:15,265 DEBUG - Named SQL query: TESTE1 -> {? = call TESTE1} - [org.hibernate.cfg.NamedSQLQuerySecondPass]
2006-04-17 21:06:15,265 DEBUG - processing association property references - [org.hibernate.cfg.Configuration]
2006-04-17 21:06:15,265 DEBUG - processing foreign key constraints - [org.hibernate.cfg.Configuration]
2006-04-17 21:06:15,328 INFO - Using Hibernate built-in connection pool (not for production use!) - [org.hibernate.connection.DriverManagerConnectionProvider]
2006-04-17 21:06:15,328 INFO - Hibernate connection pool size: 20 - [org.hibernate.connection.DriverManagerConnectionProvider]
2006-04-17 21:06:15,328 INFO - autocommit mode: false - [org.hibernate.connection.DriverManagerConnectionProvider]
2006-04-17 21:06:15,328 INFO - using driver: org.postgresql.Driver at URL: jdbc:postgresql://localhost:5432/hibernate - [org.hibernate.connection.DriverManagerConnectionProvider]
2006-04-17 21:06:15,328 INFO - connection properties: {user=W5G00A, password=endrie78} - [org.hibernate.connection.DriverManagerConnectionProvider]
2006-04-17 21:06:15,328 DEBUG - total checked-out connections: 0 - [org.hibernate.connection.DriverManagerConnectionProvider]
2006-04-17 21:06:15,328 DEBUG - opening new JDBC connection - [org.hibernate.connection.DriverManagerConnectionProvider]
2006-04-17 21:06:15,484 DEBUG - created connection to: jdbc:postgresql://localhost:5432/hibernate, Isolation Level: 2 - [org.hibernate.connection.DriverManagerConnectionProvider]
2006-04-17 21:06:15,500 INFO - RDBMS: PostgreSQL, version: 8.1.1 - [org.hibernate.cfg.SettingsFactory]
2006-04-17 21:06:15,500 INFO - JDBC driver: PostgreSQL Native Driver, version: PostgreSQL 8.1 JDBC3 with SSL (build 404) - [org.hibernate.cfg.SettingsFactory]
2006-04-17 21:06:15,500 DEBUG - returning connection to pool, pool size: 1 - [org.hibernate.connection.DriverManagerConnectionProvider]
2006-04-17 21:06:15,546 INFO - Using dialect: org.hibernate.dialect.PostgreSQLDialect - [org.hibernate.dialect.Dialect]
2006-04-17 21:06:15,546 INFO - Using default transaction strategy (direct JDBC transactions) - [org.hibernate.transaction.TransactionFactoryFactory]
2006-04-17 21:06:15,546 INFO - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended) - [org.hibernate.transaction.TransactionManagerLookupFactory]
2006-04-17 21:06:15,546 INFO - Automatic flush during beforeCompletion(): disabled - [org.hibernate.cfg.SettingsFactory]
2006-04-17 21:06:15,546 INFO - Automatic session close at end of transaction: disabled - [org.hibernate.cfg.SettingsFactory]
2006-04-17 21:06:15,546 INFO - JDBC batch size: 15 - [org.hibernate.cfg.SettingsFactory]
2006-04-17 21:06:15,546 INFO - JDBC batch updates for versioned data: disabled - [org.hibernate.cfg.SettingsFactory]
2006-04-17 21:06:15,546 INFO - Scrollable result sets: enabled - [org.hibernate.cfg.SettingsFactory]
2006-04-17 21:06:15,546 DEBUG - Wrap result sets: disabled - [org.hibernate.cfg.SettingsFactory]
2006-04-17 21:06:15,546 INFO - JDBC3 getGeneratedKeys(): disabled - [org.hibernate.cfg.SettingsFactory]
2006-04-17 21:06:15,546 INFO - Connection release mode: auto - [org.hibernate.cfg.SettingsFactory]
2006-04-17 21:06:15,546 INFO - Default batch fetch size: 1 - [org.hibernate.cfg.SettingsFactory]
2006-04-17 21:06:15,546 INFO - Generate SQL with comments: disabled - [org.hibernate.cfg.SettingsFactory]
2006-04-17 21:06:15,546 INFO - Order SQL updates by primary key: disabled - [org.hibernate.cfg.SettingsFactory]
2006-04-17 21:06:15,546 INFO - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory - [org.hibernate.cfg.SettingsFactory]
2006-04-17 21:06:15,546 INFO - Using ASTQueryTranslatorFactory - [org.hibernate.hql.ast.ASTQueryTranslatorFactory]
2006-04-17 21:06:15,546 INFO - Query language substitutions: {} - [org.hibernate.cfg.SettingsFactory]
2006-04-17 21:06:15,546 INFO - Second-level cache: enabled - [org.hibernate.cfg.SettingsFactory]
2006-04-17 21:06:15,546 INFO - Query cache: disabled - [org.hibernate.cfg.SettingsFactory]
2006-04-17 21:06:15,546 INFO - Cache provider: org.hibernate.cache.EhCacheProvider - [org.hibernate.cfg.SettingsFactory]
2006-04-17 21:06:15,562 INFO - Optimize cache for minimal puts: disabled - [org.hibernate.cfg.SettingsFactory]
2006-04-17 21:06:15,562 INFO - Structured second-level cache entries: disabled - [org.hibernate.cfg.SettingsFactory]
2006-04-17 21:06:15,562 DEBUG - Using dialect defined converter - [org.hibernate.exception.SQLExceptionConverterFactory]
2006-04-17 21:06:15,562 INFO - Statistics: disabled - [org.hibernate.cfg.SettingsFactory]
2006-04-17 21:06:15,562 INFO - Deleted entity synthetic identifier rollback: disabled - [org.hibernate.cfg.SettingsFactory]
2006-04-17 21:06:15,562 INFO - Default entity-mode: pojo - [org.hibernate.cfg.SettingsFactory]
2006-04-17 21:06:15,593 INFO - building session factory - [org.hibernate.impl.SessionFactoryImpl]
2006-04-17 21:06:15,593 DEBUG - Session factory constructed with filter configurations : {} - [org.hibernate.impl.SessionFactoryImpl]
2006-04-17 21:06:15,593 DEBUG - instantiating session factory with properties: {java.runtime.name=Java™ 2 Runtime Environment, Standard Edition, hibernate.connection.password=endrie78, sun.boot.library.path=C:\Arquivos de programas\Java\jre1.5.0_06\bin, java.vm.version=1.5.0_06-b05, hibernate.connection.username=W5G00A, java.vm.vendor=Sun Microsystems Inc., java.vendor.url=http://java.sun.com/, path.separator=;, java.vm.name=Java HotSpot™ Client VM, file.encoding.pkg=sun.io, user.country=BR, sun.os.patch.level=Service Pack 2, java.vm.specification.name=Java Virtual Machine Specification, user.dir=C:\Documents and Settings\W5G00A\workspace1\OI, java.runtime.version=1.5.0_06-b05, java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment, java.endorsed.dirs=C:\Arquivos de programas\Java\jre1.5.0_06\lib\endorsed, os.arch=x86, java.io.tmpdir=C:\DOCUME~1\W5G00A\CONFIG~1\Temp, line.separator=
, java.vm.specification.vendor=Sun Microsystems Inc., user.variant=, os.name=Windows XP, sun.jnu.encoding=Cp1252, java.library.path=C:\Arquivos de programas\Java\jre1.5.0_06\bin;.;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Arquivos de programas\Java\jdk1.5.0_06\bin, java.specification.name=Java Platform API Specification, java.class.version=49.0, sun.management.compiler=HotSpot Client Compiler, os.version=5.1, user.home=C:\Documents and Settings\W5G00A, user.timezone=America/Caracas, java.awt.printerjob=sun.awt.windows.WPrinterJob, file.encoding=Cp1252, java.specification.version=1.5, hibernate.connection.driver_class=org.postgresql.Driver, user.name=W5G00A, java.class.path=C:\Documents and Settings\W5G00A\workspace1\OI\bin;C:\Documents and Settings\W5G00A\workspace1\OI\lib\ant-1.6.5.jar;C:\Documents and Settings\W5G00A\workspace1\OI\lib\ant-antlr-1.6.5.jar;C:\Documents and Settings\W5G00A\workspace1\OI\lib\asm.jar;C:\Documents and Settings\W5G00A\workspace1\OI\lib\asm-attrs.jar;C:\Documents and Settings\W5G00A\workspace1\OI\lib\c3p0-0.9.0.jar;C:\Documents and Settings\W5G00A\workspace1\OI\lib\cglib-2.1.3.jar;C:\Documents and Settings\W5G00A\workspace1\OI\lib\classes12.jar;C:\Documents and Settings\W5G00A\workspace1\OI\lib\commons-collections-2.1.1.jar;C:\Documents and Settings\W5G00A\workspace1\OI\lib\commons-logging-1.0.4.jar;C:\Documents and Settings\W5G00A\workspace1\OI\lib\dom4j-1.6.1.jar;C:\Documents and Settings\W5G00A\workspace1\OI\lib\ehcache-1.1.jar;C:\Documents and Settings\W5G00A\workspace1\OI\lib\hibernate3.jar;C:\Documents and Settings\W5G00A\workspace1\OI\lib\jta.jar;C:\Documents and Settings\W5G00A\workspace1\OI\lib\log4j-1.2.11.jar;C:\Documents and Settings\W5G00A\workspace1\OI\lib\ojdbc14.jar;C:\Documents and Settings\W5G00A\workspace1\OI\lib\oscache-2.1.jar;C:\Documents and Settings\W5G00A\workspace1\OI\lib\postgresql-8.1-404.jdbc3.jar;C:\Documents and Settings\W5G00A\workspace1\OI\lib\xml-apis.jar, java.vm.specification.version=1.0, sun.arch.data.model=32, java.home=C:\Arquivos de programas\Java\jre1.5.0_06, hibernate.connection.url=jdbc:postgresql://localhost:5432/hibernate, hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect, java.specification.vendor=Sun Microsystems Inc., user.language=pt, awt.toolkit=sun.awt.windows.WToolkit, java.vm.info=mixed mode, sharing, hibernate.cglib.use_reflection_optimizer=true, java.version=1.5.0_06, java.ext.dirs=C:\Arquivos de programas\Java\jre1.5.0_06\lib\ext, sun.boot.class.path=C:\Arquivos de programas\Java\jre1.5.0_06\lib\rt.jar;C:\Arquivos de programas\Java\jre1.5.0_06\lib\i18n.jar;C:\Arquivos de programas\Java\jre1.5.0_06\lib\sunrsasign.jar;C:\Arquivos de programas\Java\jre1.5.0_06\lib\jsse.jar;C:\Arquivos de programas\Java\jre1.5.0_06\lib\jce.jar;C:\Arquivos de programas\Java\jre1.5.0_06\lib\charsets.jar;C:\Arquivos de programas\Java\jre1.5.0_06\classes, java.vendor=Sun Microsystems Inc., file.separator=, java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport.cgi, sun.cpu.endian=little, sun.io.unicode.encoding=UnicodeLittle, sun.desktop=windows, sun.cpu.isalist=pentium_pro+mmx pentium_pro pentium+mmx pentium i486 i386 i86} - [org.hibernate.impl.SessionFactoryImpl]
2006-04-17 21:06:15,593 DEBUG - Creating new CacheManager with default config - [net.sf.ehcache.CacheManager]
2006-04-17 21:06:15,593 DEBUG - Configuring ehcache from classpath. - [net.sf.ehcache.CacheManager]
2006-04-17 21:06:15,593 WARN - No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath: jar:file:/C:/Documents%20and%20Settings/W5G00A/workspace1/OI/lib/ehcache-1.1.jar!/ehcache-failsafe.xml - [net.sf.ehcache.config.Configurator]
2006-04-17 21:06:15,609 DEBUG - Disk Store Path: C:\DOCUME~1\W5G00A\CONFIG~1\Temp\ - [net.sf.ehcache.config.Configuration$DiskStore]
2006-04-17 21:06:15,875 DEBUG - Static SQL for entity: br.com.Pessoa - [org.hibernate.persister.entity.AbstractEntityPersister]
2006-04-17 21:06:15,875 DEBUG - Version select: select cpf from public.pessoa where cpf =? - [org.hibernate.persister.entity.AbstractEntityPersister]
2006-04-17 21:06:15,875 DEBUG - Snapshot select: select pessoa_.cpf, pessoa_.nome as nome0_, pessoa_.dtnascimento as dtnascim3_0_ from public.pessoa pessoa_ where pessoa_.cpf=? - [org.hibernate.persister.entity.AbstractEntityPersister]
2006-04-17 21:06:15,890 DEBUG - Insert 0: insert into public.pessoa (nome, dtnascimento, cpf) values (?, ?, ?) - [org.hibernate.persister.entity.AbstractEntityPersister]
2006-04-17 21:06:15,890 DEBUG - Update 0: update public.pessoa set nome=?, dtnascimento=? where cpf=? - [org.hibernate.persister.entity.AbstractEntityPersister]
2006-04-17 21:06:15,890 DEBUG - Delete 0: delete from public.pessoa where cpf=? - [org.hibernate.persister.entity.AbstractEntityPersister]
2006-04-17 21:06:15,921 DEBUG - Static select for entity br.com.Pessoa: select pessoa0_.cpf as cpf0_0_, pessoa0_.nome as nome0_0_, pessoa0_.dtnascimento as dtnascim3_0_0_ from public.pessoa pessoa0_ where pessoa0_.cpf=? - [org.hibernate.loader.entity.EntityLoader]
2006-04-17 21:06:15,921 DEBUG - Static select for entity br.com.Pessoa: select pessoa0_.cpf as cpf0_0_, pessoa0_.nome as nome0_0_, pessoa0_.dtnascimento as dtnascim3_0_0_ from public.pessoa pessoa0_ where pessoa0_.cpf=? - [org.hibernate.loader.entity.EntityLoader]
2006-04-17 21:06:15,921 DEBUG - Static select for entity br.com.Pessoa: select pessoa0_.cpf as cpf0_0_, pessoa0_.nome as nome0_0_, pessoa0_.dtnascimento as dtnascim3_0_0_ from public.pessoa pessoa0_ where pessoa0_.cpf=? for update - [org.hibernate.loader.entity.EntityLoader]
2006-04-17 21:06:15,921 DEBUG - Static select for entity br.com.Pessoa: select pessoa0_.cpf as cpf0_0_, pessoa0_.nome as nome0_0_, pessoa0_.dtnascimento as dtnascim3_0_0_ from public.pessoa pessoa0_ where pessoa0_.cpf=? for update - [org.hibernate.loader.entity.EntityLoader]
2006-04-17 21:06:15,984 DEBUG - Static select for action ACTION_MERGE on entity br.com.Pessoa: select pessoa0_.cpf as cpf0_0_, pessoa0_.nome as nome0_0_, pessoa0_.dtnascimento as dtnascim3_0_0_ from public.pessoa pessoa0_ where pessoa0_.cpf=? - [org.hibernate.loader.entity.EntityLoader]
2006-04-17 21:06:15,984 DEBUG - Static select for action ACTION_REFRESH on entity br.com.Pessoa: select pessoa0_.cpf as cpf0_0_, pessoa0_.nome as nome0_0_, pessoa0_.dtnascimento as dtnascim3_0_0_ from public.pessoa pessoa0_ where pessoa0_.cpf=? - [org.hibernate.loader.entity.EntityLoader]
2006-04-17 21:06:15,984 DEBUG - initializing class SessionFactoryObjectFactory - [org.hibernate.impl.SessionFactoryObjectFactory]
2006-04-17 21:06:15,984 DEBUG - registered: 402880850aaa8889010aaa888b300000 (unnamed) - [org.hibernate.impl.SessionFactoryObjectFactory]
2006-04-17 21:06:15,984 INFO - Not binding factory to JNDI, no JNDI name configured - [org.hibernate.impl.SessionFactoryObjectFactory]
2006-04-17 21:06:15,984 DEBUG - instantiated session factory - [org.hibernate.impl.SessionFactoryImpl]
2006-04-17 21:06:15,984 DEBUG - Checking 0 named HQL queries - [org.hibernate.impl.SessionFactoryImpl]
2006-04-17 21:06:15,984 DEBUG - Checking 1 named SQL queries - [org.hibernate.impl.SessionFactoryImpl]
2006-04-17 21:06:15,984 DEBUG - Checking named SQL query: TESTE1 - [org.hibernate.impl.SessionFactoryImpl]
2006-04-17 21:06:15,984 DEBUG - unable to locate native-sql query plan in cache; generating ({? = call TESTE1}) - [org.hibernate.engine.query.QueryPlanCache]
2006-04-17 21:06:16,000 DEBUG - persisting FucTeste - [br.com.PessoaHome]
java.lang.ClassCastException: org.hibernate.impl.SQLQueryImpl
at br.com.PessoaHome.FucTeste(PessoaHome.java:52)
at br.com.TestePessoaFunc.main(TestePessoaFunc.java:7)
2006-04-17 21:06:16,046 DEBUG - opened session at timestamp: 4691240452096000 - [org.hibernate.impl.SessionImpl]
2006-04-17 21:06:16,046 ERROR - persist failed - [br.com.PessoaHome]
java.lang.ClassCastException: org.hibernate.impl.SQLQueryImpl
at br.com.PessoaHome.FucTeste(PessoaHome.java:52)
at br.com.TestePessoaFunc.main(TestePessoaFunc.java:7)

Quem puder me ajudar eu agradeço atencipadamente,
Jaime

obs:
Postgres 8.1
JDK 1.5
Eclipse 3.1.2
Hibernate 3.1.3

O erro tem nada a ver com Hibernate:

 java.lang.ClassCastException: org.hibernate.impl.SQLQueryImpl
at br.com.PessoaHome.FucTeste(PessoaHome.java:52)
at br.com.TestePessoaFunc.main(TestePessoaFunc.java:7) 

Que aponta para esta linha:

Pessoa p = (Pessoa) session.getNamedQuery("TESTE1"); 

O método getNamedQuery não retorna um objeto pessoa. Retorna um objeto Query. Deve fazer algo assim:

Query q = session.getNamedQuery("TESTE1");

// apenas para teste, presume que sempre retorna 1 resultado
Pessoa p = ( Pessoa ) q.list().get( 0 );

Apontamentos:

  • siga convenções de código, é melhor para você e para todo mundo que lerá seu código:
    http://java.sun.com/docs/codeconv/
  • ao postar código coloque-o entre as tags [ code]seucodigo[ /code], assim ele ficará formatado.

Felipe agradeço a sua atenção. Realizei a alteração porém a mesma agora esta informando que o seguinte:
code:
2006-04-18 11:11:32,390 ERROR br.PessoaHome -> persist failed
java.lang.UnsupportedOperationException: org.hibernate.dialect.PostgreSQLDialect does not support resultsets via stored procedures
at org.hibernate.dialect.Dialect.registerResultSetOutParameter(Dialect.java:900)
at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1574)
at org.hibernate.loader.Loader.doQuery(Loader.java:661)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
at org.hibernate.loader.Loader.doList(Loader.java:2145)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029)
at org.hibernate.loader.Loader.list(Loader.java:2024)
at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:111)
at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1655)
at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:142)
at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:164)
at br.PessoaHome.FucTeste(PessoaHome.java:52)
at br.TestePessoaHibernate.main(TestePessoaHibernate.java:11)
java.lang.UnsupportedOperationException: org.hibernate.dialect.PostgreSQLDialect does not support resultsets via stored procedures
at org.hibernate.dialect.Dialect.registerResultSetOutParameter(Dialect.java:900)
at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1574)
at org.hibernate.loader.Loader.doQuery(Loader.java:661)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
at org.hibernate.loader.Loader.doList(Loader.java:2145)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029)
at org.hibernate.loader.Loader.list(Loader.java:2024)
at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:111)
at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1655)
at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:142)
at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:164)
at br.PessoaHome.FucTeste(PessoaHome.java:52)
at br.TestePessoaHibernate.main(TestePessoaHibernate.java:11)

Sabe me dizer se o hibernate para o banco postgres nao aceita store procedure?
agradeço

Este trecho diz que não suporta. Talvez possa ser a versão do driver JDBC do postgres (pouco provável pela mensagem acima). Se vc estiver com a versão correta, então acredito que realmente não suporta.