Erro no Hibernate [RESOLVIDO]

32 respostas
J

Olá pessoal,
gostaria de pedir ajuda por causa desse bendito erro que eu vejo inumeras pessoas com mesmo erro, porem nao vejo solução para o problema… Estou tentando iniciar com o Hibernate, mas está dando o seguinte erro:

log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment). log4j:WARN Please initialize the log4j system properly. Não foi possivel, Erro: Error reading resource: teste/Usuario.hbm.xml

Não sei + o que fazer…
Alguém me ajude PELO AMOR DE DEUS!!!
eu fiz tudo que esta no seguinte tutorial : http://www.livramento.yu.com.br/Hibernate.html

OBS.: Estou utilizando Eclipse e Postgres
abraço e ficarei grato se puderem me ajudar. :frowning:

32 Respostas

D

Aparentemente existe um mapeamento no hibernate.cfg.xml que aponta para teste/Usuario.hbm.xml, porém este arquivo não está sendo encontrado. Certifique-se que ele esteja dentro do diretório de fontes de sua aplicacao (src).

J

Sim, estão todos no mesmo local ;/

D

Cara, imprima o erro completo e poste aqui:

catch(Exception e) 
		{    
                       e.printStackTrace();
			System.out.println("N�o foi possivel, Erro: " + e.getMessage()); 
		}
J

Erro:

log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment). log4j:WARN Please initialize the log4j system properly. org.hibernate.MappingException: Error reading resource: teste/Usuario.hbm.xml at org.hibernate.cfg.Configuration.addClass(Configuration.java:471) at teste.UsuarioDAO.<init>(UsuarioDAO.java:12) at teste.Teste.main(Teste.java:15) Caused by: org.hibernate.MappingException: org.dom4j.DocumentException: Error on line 1 of document : The markup in the document preceding the root element must be well-formed. Nested exception: The markup in the document preceding the root element must be well-formed. at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:408) at org.hibernate.cfg.Configuration.addClass(Configuration.java:468) ... 2 more Caused by: org.dom4j.DocumentException: Error on line 1 of document : The markup in the document preceding the root element must be well-formed. Nested exception: The markup in the document preceding the root element must be well-formed. at org.dom4j.io.SAXReader.read(SAXReader.java:482) at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:398) ... 3 more Não foi possivel, Erro: Error reading resource: teste/Usuario.hbm.xml

D

Cara, teu XML está com problema, talvez ao copiar do site com o tutorial tenha ficado alguma sujeira, alguma linha em branco com algum caracter ou algo do tipo, refaça-o e teste.

J

Enquanto fui conferir no tutorial eu li novamente e tem uma parte abaixo do exemplo do Usuario.hbm.xml q diz o seguinte:

Verifique que este xml será validado pelo arquivo hibernate-mapping-3.0.dtd.
Como voce ainda não tem este arquivo em sua máquina, faça uma busca rápida no professor google com o texto “hibernate-mapping-3.0.dtd” deverão surgir alguns links deste arquivo, quando voce clicar ele abrirá como um arquivo texto, peque o conteúdo e salve com o nome acima dentro da pasta raiz do seu projeto, no nosso caso, na pasta SeuProjeto.
Este recurso evita que o sistema não encontre o validador quando voce estiver rodando a plicação sem uma conexao com a web.

mas não estou encontrando esse bendito hibernate-mapping-3.0.dtd :?

D

Teu xml deve começar assim:

<?xml version="1.0" encoding="UTF-8"?>
J

Eu fiz isso e continua com o mesmo problema ; /

J

Os codigos estao da seguinte forma:

Teste.java
public class Teste {
	
public static void main(String[] args) throws Exception { 
		
		try 
		{ 
			String usCod = "login"; 
			String usSenha = "abc"; 
			String usNome = "Rafael"; 
			String usEmail = "[email removido]";

			UsuarioDAO dao = new UsuarioDAO(); 
			Usuario usuario = new Usuario(usCod,usSenha,usNome,usEmail);		
			dao.UsInserir(usuario);
			System.out.println("Registro inserido com sucesso!!!");
			} 
			catch(Exception e) 
			{    
								e.printStackTrace();
				System.out.println("Não foi possivel, Erro: " + e.getMessage()); 
			} 
		} 
	
}
Usuario.java
public class Usuario {
	
	private String usCod;
	private String usSenha;
	private String usNome;
	private String usEmail;

	public Usuario(){
	}		 

	public Usuario(String usCod, String usSenha, String usNome, String usEmail) {
		this.setUsCod(usCod);
		this.setUsSenha(usSenha);
		this.setUsNome(usNome);
		this.setUsEmail(usEmail);
	}

	public String getUsCod() {
		return usCod;
	}

	public void setUsCod(String usCod) {
		this.usCod = usCod;
	}

	public String getUsSenha() {
		return usSenha;
	}

	public void setUsSenha(String usSenha) {
		this.usSenha = usSenha;
	}

	public String getUsNome() {
		return usNome;
	}

	public void setUsNome(String usNome) {
		this.usNome = usNome;
	}

	public String getUsEmail() {
		return usEmail;
	}

	public void setUsEmail(String usEmail) {
		this.usEmail = usEmail;
	}
	
}
UsuarioDAO.java
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
import org.hibernate.classic.Session;

public class UsuarioDAO{
	
	private SessionFactory factory;
	
	public UsuarioDAO() throws Exception{
		factory = new Configuration().addClass(Usuario.class).buildSessionFactory();
		
	}     
	
	public void UsInserir(Usuario us) throws Exception {
		Session session = factory.openSession();
		session.save(us);
		session.flush();
		session.close();
	}
	
	public void UsAlterar(Usuario us) throws Exception {
		Session session = factory.openSession();
		session.update(us);
		session.flush();
		session.close();
	}
	public void UsExcluir(Usuario us) throws Exception {
		Session session = factory.openSession();
		session.delete(us);
		session.flush();
		session.close();
	}
}
hibernate.properties
hibernate.dialect= org.hibernate.dialect.PostgreSQLDialect
 hibernate.connection.driver_class = org.postgresql.Driver
 hibernate.connection.url = jdbc:postgresql://xxxx
 hibernate.connection.username = usuario
 hibernate.connection.password = senha
log4j.properties
log4j.rootLogger=DEBUG, dest1

 log4j.appender.dest1=org.apache.log4j.ConsoleAppender
 log4j.appender.dest1.layout=org.apache.log4j.PatternLayout
 log4j.appender.dest1.layout.ConversionPattern=%d %-5p %-5c{3} %x -> %m%n

 #log4j.appender.dest2=org.apache.log4j.RollingFileAppender
 #log4j.appender.dest2.File=bridge.log

 #log4j.appender.dest2.MaxFileSize=100KB
 # Keep one backup file
 #log4j.appender.dest2.MaxBackupIndex=3

 #log4j.appender.dest2.layout=org.apache.log4j.PatternLayout
 #log4j.appender.dest2.layout.ConversionPattern=%d [%t] %-5p %-5c{3}(%L) %x -> %m%n
Usuario.hbm.xml
< ?xml version="1.0" encoding='UTF-8'?>
< !DOCTYPE hibernate-mapping PUBLIC "-//Hibernate Mapping DTD 3.0//EN"
"hibernate-mapping-3.0.dtd">

<hibernate-mapping>
   <class name="Usuario" table="tb_usuario">
       <id name="usCod"  column="USCOD"  type="string">
            < generator class="assigned"/>
        </id>
        < property name="usSenha" column="USSENHA" type="string"/>
        < property name="usNome" column="USNOME" type="string"/>
        < property name="usEmail" column="USEMAIL" type="string"/>
    </class>
</hibernate-mapping>
D

Não está igual não, existem dois espaços que não deveriam estar aí logo após o < que inicia as linhas: :evil:

< ?xml version=“1.0” encoding=‘UTF-8’?>
< !DOCTYPE hibernate-mapping PUBLIC “-//Hibernate Mapping DTD 3.0//EN”

Aliás, existem vários < que têm espaços depois

J

Tirei os espaços e continuou dando o mesmo erro :shock: :x :cry:

R

Também tive problemas com o hibernate, fiz o seguinte:

Segui esse tutorial:
http://www.marvinlemos.net/download/arquivo/118/hibernate_annotation.pdf

E o que mais deu problema no inicio foi os jar’s, mas consegui usando essa lista:


J

Obrigado pela dica Rafael :smiley:
Eu vou seguir esse tutorial e assim q eu terminar eu digo como foi… nao sei se vai da tempo de eu terminar hoje porque vou sair do estágio ja ja :stuck_out_tongue:

abraço

J

Acho que o problema está acontecendo pois você não colocou o log4j no classpath da sua aplicação!

[]'s

D

Não creio nisso, pois os logs estão sendo gerados perfeitamente. Ainda acho que é problema no XML. :?

J

Esse Hibernate nao é de Deus não, não é possível.
Eu estou fazendo o tutorial que o Rafael passou mas ja esta dando erro… afff :x

D

:lol: “Não é de Deus” é fogo, as vezes é assim mesmo, depois que voce configurar a primeira vez embala. Vai postando os erros que a galera vai ajudando. Nao desista! :wink:

R

Posta ai o erro, provavelmente é nos jar’s, se você tiver aquela lista de jar’s ali no classpath não vai dar erro nenhum…
Baixei as libs

hibernate-core
hibernate-annotation

e procura no google pelas lib’s

commons-annotations
javax.persistance

J

Eu fiz o tutorial ate 1.9 TESTANDO A APLICAÇÃO mas quando coloco para rodar da o seguinte erro:

log4j:WARN No appenders could be found for logger (org.hibernate.cfg.annotations.Version). log4j:WARN Please initialize the log4j system properly. Initial SessionFactory creation failed.org.hibernate.HibernateException: /hibernate.cfg.xml not found Exception in thread "main" java.lang.ExceptionInInitializerError at teste.HibernateUtil.<clinit>(HibernateUtil.java:16) at teste.dao.ClienteDAO.salvar(ClienteDAO.java:14) at teste.dao.Principal.main(Principal.java:20) Caused by: org.hibernate.HibernateException: /hibernate.cfg.xml not found at org.hibernate.util.ConfigHelper.getResourceAsStream(ConfigHelper.java:170) at org.hibernate.cfg.Configuration.getConfigurationInputStream(Configuration.java:1439) at org.hibernate.cfg.Configuration.configure(Configuration.java:1461) at org.hibernate.cfg.AnnotationConfiguration.configure(AnnotationConfiguration.java:967) at org.hibernate.cfg.AnnotationConfiguration.configure(AnnotationConfiguration.java:64) at org.hibernate.cfg.Configuration.configure(Configuration.java:1448) at org.hibernate.cfg.AnnotationConfiguration.configure(AnnotationConfiguration.java:961) at teste.HibernateUtil.<clinit>(HibernateUtil.java:12) ... 2 more
:?
ahh… valeu pelo apoio galera :wink:

R

na raiz(default package) tu criou o arquivo log4j.properties e o arquivo hibernate.cfg.xml?
Se sim, posta o hibernate cfg.xml para ver se não tem erro

J

Então Rafael, eu achei estranho por que no tutorial ele nao fez a criação do log4j.properties, mas o hibernate.cfg.xml eu fiz sim.

hibernate.cfg.xml
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
	"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
	<hibernate-configuration>
	<session-factory>
		<!-- Database connection settings -->
		<property name="connection.driver_class">org.postgresql.Driver</property>
		<property name="connection.url">jdbc:postgresql://localhost:5432/jarf</property>
		<property name="connection.username">postgres</property>
		<property name="connection.password"></property>
		<!-- JDBC connection pool (use the built-in) -->
		<property name="connection.pool_size">1</property>
		<!-- SQL dialect -->
		<property name="dialect">org.hibernate.dialect.PostgreSQLDialect</property>
		<!-- Enable Hibernate's automatic session context management -->
		<property name="current_session_context_class">thread</property>
		<!-- Disable the second-level cache -->
		<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
		<!-- Echo all executed SQL to stdout -->
	<property name="show_sql">true</property>
	<mapping class="teste.Cliente"/>
	</session-factory>
</hibernate-configuration>

eu criei a package teste como esta no tutorial e o hibernate.cfg.xml esta dentro dela, junto com Cliente.java e HibernateUtil.java. E em outra package chamada teste.dao estao ClienteDAO.java e Principal.java.

Estao em local errado? :roll:

Será q esse Dialect do Postgres ta certo? =(

P

(SE INTERESSAR ME MANDE UM EMAIL QUE RETORNAREI O APLICATIVO [email removido])

Bom Dia vi o topico no forum tenho um exemplo de utilização que fiz no Eclipse pode servir para vc.
Esta bem simples usei so o necessario mesmo esta como um projeto Web no TomCat 6 e Java 6 mas na verdade vc não precisa levantar o servidor para testar é so executar a classe TestaHibernate.java dentro de control.

Esta configurado para criar suas tabelas então é necessario somente vc criar o banco de dados e execute que ele gerara as tabelas para vc.

J

Ahh… Blz pissurno :wink:
ja enviei o e-mail :slight_smile:

R

eu criei a package teste como esta no tutorial e o hibernate.cfg.xml esta dentro dela, junto com Cliente.java e HibernateUtil.java. E em outra package chamada teste.dao estao ClienteDAO.java e Principal.java.

Deixe ele fora de todas as packages(aqui no netbeans aparece como default package)

J

Dentro da pasta src(pasta src esta dentro da pasta do projeto) ou dentro da pasta do projeto?

V

Dentro da src.

Flw! :thumbup:

J

Dentro da pasta src da mais erro que antes… :-o

log4j:WARN No appenders could be found for logger (org.hibernate.cfg.annotations.Version). log4j:WARN Please initialize the log4j system properly. Hibernate: select nextval ('hibernate_sequence') Exception in thread "main" org.hibernate.exception.SQLGrammarException: could not get next sequence value at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:90) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66) at org.hibernate.id.SequenceGenerator.generate(SequenceGenerator.java:119) at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:122) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:210) at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:56) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:195) at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:50) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:93) at org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:562) at org.hibernate.impl.SessionImpl.save(SessionImpl.java:550) at org.hibernate.impl.SessionImpl.save(SessionImpl.java:546) 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:597) at org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:342) at $Proxy8.save(Unknown Source) at teste.dao.ClienteDAO.salvar(ClienteDAO.java:16) at teste.dao.Principal.main(Principal.java:20) Caused by: org.postgresql.util.PSQLException: ERROR: relation "hibernate_sequence" does not exist at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1548) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1316) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:191) at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:452) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:351) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:255) at org.hibernate.id.SequenceGenerator.generate(SequenceGenerator.java:98) ... 17 more

R

Agora tu pode ver que ele achou o hibernate.cfg.xml, tenta coloca o log4j.properties junto com o hibernate.cfg.xml

log4j.properties

### direct log messages to stdout ###
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n

### direct messages to file hibernate.log ###
#log4j.appender.file=org.apache.log4j.FileAppender
#log4j.appender.file.File=hibernate.log
#log4j.appender.file.layout=org.apache.log4j.PatternLayout
#log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n

### set log levels - for more verbose logging change 'info' to 'debug' ###

log4j.rootLogger=warn, stdout

#log4j.logger.org.hibernate=info
log4j.logger.org.hibernate=debug

### log HQL query parser activity
#log4j.logger.org.hibernate.hql.ast.AST=debug

### log just the SQL
#log4j.logger.org.hibernate.SQL=debug

### log JDBC bind parameters ###
log4j.logger.org.hibernate.type=info
#log4j.logger.org.hibernate.type=debug

### log schema export/update ###
log4j.logger.org.hibernate.tool.hbm2ddl=debug

### log HQL parse trees
#log4j.logger.org.hibernate.hql=debug

### log cache activity ###
#log4j.logger.org.hibernate.cache=debug

### log transaction activity
#log4j.logger.org.hibernate.transaction=debug

### log JDBC resource acquisition
#log4j.logger.org.hibernate.jdbc=debug

### enable the following line if you want to track down connection ###
### leakages when using DriverManagerConnectionProvider ###
#log4j.logger.org.hibernate.connection.DriverManagerConnectionProvider=trace
J

Nossa… O bicho se revoltou agora e disparou um monte hahaha… Ô.ó
olha o que deu agora:

11:07:43,482 INFO Version:15 - Hibernate Annotations 3.4.0.CR1 11:07:43,534 INFO Environment:543 - Hibernate 3.3.1.GA 11:07:43,543 INFO Environment:576 - hibernate.properties not found 11:07:43,550 INFO Environment:709 - Bytecode provider name : javassist 11:07:43,572 INFO Environment:627 - using JDK 1.4 java.sql.Timestamp handling 11:07:43,711 INFO Version:14 - Hibernate Commons Annotations 3.1.0.GA 11:07:43,716 INFO Configuration:1460 - configuring from resource: /hibernate.cfg.xml 11:07:43,719 INFO Configuration:1437 - Configuration resource: /hibernate.cfg.xml 11:07:43,894 DEBUG DTDEntityResolver:64 - trying to resolve system-id [http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd] 11:07:43,895 DEBUG DTDEntityResolver:66 - recognized hibernate namespace; attempting to resolve on classpath under org/hibernate/ 11:07:43,897 DEBUG DTDEntityResolver:76 - located [http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd] in classpath 11:07:43,970 DEBUG Configuration:1421 - connection.driver_class=org.postgresql.Driver 11:07:43,971 DEBUG Configuration:1421 - connection.url=jdbc:postgresql://localhost:5432/jarf 11:07:43,972 DEBUG Configuration:1421 - connection.username=postgres 11:07:43,973 DEBUG Configuration:1421 - connection.password= 11:07:43,974 DEBUG Configuration:1421 - connection.pool_size=1 11:07:43,975 DEBUG Configuration:1421 - dialect=org.hibernate.dialect.PostgreSQLDialect 11:07:43,976 DEBUG Configuration:1421 - current_session_context_class=thread 11:07:43,976 DEBUG Configuration:1421 - cache.provider_class=org.hibernate.cache.NoCacheProvider 11:07:43,977 DEBUG Configuration:1421 - show_sql=true 11:07:43,979 DEBUG AnnotationConfiguration:627 - null <- org.dom4j.tree.DefaultAttribute@60420f [Attribute: name class value "teste.Cliente"] 11:07:44,004 INFO Configuration:1575 - Configured SessionFactory: null 11:07:44,017 DEBUG Configuration:1576 - properties: {hibernate.connection.password=, java.runtime.name=Java(TM) SE Runtime Environment, hibernate.cache.provider_class=org.hibernate.cache.NoCacheProvider, sun.boot.library.path=/usr/local/jdk1.6.0_05/jre/lib/i386, java.vm.version=10.0-b19, hibernate.connection.username=postgres, java.vm.vendor=Sun Microsystems Inc., java.vendor.url=http://java.sun.com/, path.separator=:, java.vm.name=Java HotSpot(TM) Client VM, file.encoding.pkg=sun.io, user.country=US, sun.java.launcher=SUN_STANDARD, sun.os.patch.level=unknown, java.vm.specification.name=Java Virtual Machine Specification, user.dir=/home/Jarf/workspace/teste_hibernate, java.runtime.version=1.6.0_05-b13, java.awt.graphicsenv=sun.awt.X11GraphicsEnvironment, hibernate.current_session_context_class=thread, java.endorsed.dirs=/usr/local/jdk1.6.0_05/jre/lib/endorsed, os.arch=i386, java.io.tmpdir=/tmp, line.separator= , java.vm.specification.vendor=Sun Microsystems Inc., cache.provider_class=org.hibernate.cache.NoCacheProvider, os.name=Linux, sun.jnu.encoding=ISO-8859-1, java.library.path=/usr/local/jdk1.6.0_05/jre/lib/i386/client:/usr/local/jdk1.6.0_05/jre/lib/i386:/usr/local/jdk1.6.0_05/jre/../lib/i386:/usr/local/jdk1.6.0_05/jre/lib/i386/client::/usr/local/jdk1.6.0_05/jre/lib/i386::/usr/lib/seamonkey/:/usr/lib/seamonkey/:/usr/java/packages/lib/i386:/lib:/usr/lib, java.specification.name=Java Platform API Specification, java.class.version=50.0, hibernate.connection.pool_size=1, sun.management.compiler=HotSpot Client Compiler, os.version=2.6.21.5-smp, connection.password=, user.home=/home/Jarf, user.timezone=America/Sao_Paulo, connection.username=postgres, java.awt.printerjob=sun.print.PSPrinterJob, file.encoding=ISO-8859-1, java.specification.version=1.6, hibernate.connection.driver_class=org.postgresql.Driver, show_sql=true, user.name=Jarf, java.class.path=/home/Jarf/workspace/teste_hibernate/bin:/home/Jarf/Hibernate/hibernate-distribution-3.3.1.GA/hibernate3.jar:/home/Jarf/Hibernate/hibernate-distribution-3.3.1.GA/lib/required/antlr-2.7.6.jar:/home/Jarf/Hibernate/hibernate-distribution-3.3.1.GA/lib/required/commons-collections-3.1.jar:/home/Jarf/Hibernate/hibernate-distribution-3.3.1.GA/lib/required/dom4j-1.6.1.jar:/home/Jarf/Hibernate/hibernate-distribution-3.3.1.GA/lib/required/javassist-3.4.GA.jar:/home/Jarf/Hibernate/hibernate-distribution-3.3.1.GA/lib/required/jta-1.1.jar:/home/Jarf/Hibernate/hibernate-distribution-3.3.1.GA/lib/required/slf4j-api-1.5.2.jar:/home/Jarf/Hibernate/hibernate-distribution-3.3.1.GA/lib/bytecode/cglib/hibernate-cglib-repack-2.1_3.jar:/home/Jarf/Hibernate/hibernate-distribution-3.3.1.GA/lib/bytecode/javassist/javassist-3.4.GA.jar:/home/Jarf/Hibernate/hibernate-distribution-3.3.1.GA/lib/optional/c3p0/c3p0-0.9.1.jar:/home/Jarf/Hibernate/hibernate-distribution-3.3.1.GA/lib/optional/ehcache/ehcache-1.2.3.jar:/home/Jarf/Hibernate/hibernate-distribution-3.3.1.GA/lib/optional/jbosscache/jboss-cache-1.4.1.GA.jar:/home/Jarf/Hibernate/hibernate-distribution-3.3.1.GA/lib/optional/jbosscache2/jbosscache-core-2.1.1.GA.jar:/home/Jarf/Hibernate/hibernate-distribution-3.3.1.GA/lib/optional/oscache/oscache-2.1.jar:/home/Jarf/Hibernate/hibernate-distribution-3.3.1.GA/lib/optional/proxool/proxool-0.8.3.jar:/home/Jarf/Hibernate/hibernate-distribution-3.3.1.GA/lib/optional/swarmcache/swarmcache-1.0RC2.jar:/home/Jarf/Hibernate/hibernate-validator-3.1.0.GA/hibernate-validator.jar:/home/Jarf/Hibernate/hibernate-validator-3.1.0.GA/lib/ejb3-persistence.jar:/home/Jarf/Hibernate/hibernate-validator-3.1.0.GA/lib/hibernate-commons-annotations.jar:/home/Jarf/Hibernate/hibernate-validator-3.1.0.GA/lib/hibernate-core.jar:/home/Jarf/Hibernate/hibernate-validator-3.1.0.GA/lib/javassist.jar:/home/Jarf/Hibernate/hibernate-validator-3.1.0.GA/lib/slf4j-api.jar:/home/Jarf/Hibernate/hibernate-validator-3.1.0.GA/lib/build/ant-junit-1.6.5.jar:/home/Jarf/Hibernate/hibernate-validator-3.1.0.GA/lib/build/junit-3.8.1.jar:/home/Jarf/Hibernate/hibernate-validator-3.1.0.GA/lib/test/antlr.jar:/home/Jarf/Hibernate/hibernate-validator-3.1.0.GA/lib/test/asm.jar:/home/Jarf/Hibernate/hibernate-validator-3.1.0.GA/lib/test/asm-attrs.jar:/home/Jarf/Hibernate/hibernate-validator-3.1.0.GA/lib/test/commons-collections.jar:/home/Jarf/Hibernate/hibernate-validator-3.1.0.GA/lib/test/dom4j.jar:/home/Jarf/Hibernate/hibernate-validator-3.1.0.GA/lib/test/hibernate-annotations.jar:/home/Jarf/Hibernate/hibernate-validator-3.1.0.GA/lib/test/hibernate-entitymanager.jar:/home/Jarf/Hibernate/hibernate-validator-3.1.0.GA/lib/test/jta.jar:/home/Jarf/Hibernate/hibernate-validator-3.1.0.GA/lib/test/junit.jar:/home/Jarf/Hibernate/hibernate-validator-3.1.0.GA/lib/test/log4j.jar:/home/Jarf/Hibernate/hibernate-validator-3.1.0.GA/lib/test/slf4j-log4j12.jar:/home/Jarf/Hibernate/hibernate-annotations-3.4.0.GA/hibernate-annotations.jar:/home/Jarf/Hibernate/hibernate-annotations-3.4.0.GA/lib/dom4j.jar:/home/Jarf/Hibernate/hibernate-annotations-3.4.0.GA/lib/ejb3-persistence.jar:/home/Jarf/Hibernate/hibernate-annotations-3.4.0.GA/lib/hibernate-commons-annotations.jar:/home/Jarf/Hibernate/hibernate-annotations-3.4.0.GA/lib/hibernate-core.jar:/home/Jarf/Hibernate/hibernate-annotations-3.4.0.GA/lib/slf4j-api.jar:/home/Jarf/Hibernate/hibernate-annotations-3.4.0.GA/lib/build/ant-contrib-1.0b2.jar:/home/Jarf/Hibernate/hibernate-annotations-3.4.0.GA/lib/build/ant-junit-1.6.5.jar:/home/Jarf/Hibernate/hibernate-annotations-3.4.0.GA/lib/build/junit-3.8.1.jar:/home/Jarf/Hibernate/hibernate-annotations-3.4.0.GA/lib/test/antlr.jar:/home/Jarf/Hibernate/hibernate-annotations-3.4.0.GA/lib/test/asm.jar:/home/Jarf/Hibernate/hibernate-annotations-3.4.0.GA/lib/test/asm-attrs.jar:/home/Jarf/Hibernate/hibernate-annotations-3.4.0.GA/lib/test/commons-collections.jar:/home/Jarf/Hibernate/hibernate-annotations-3.4.0.GA/lib/test/javassist.jar:/home/Jarf/Hibernate/hibernate-annotations-3.4.0.GA/lib/test/jta.jar:/home/Jarf/Hibernate/hibernate-annotations-3.4.0.GA/lib/test/junit.jar:/home/Jarf/Hibernate/hibernate-annotations-3.4.0.GA/lib/test/log4j.jar:/home/Jarf/Hibernate/hibernate-annotations-3.4.0.GA/lib/test/slf4j-log4j12.jar:/usr/local/globus-4.0.6/lib/postgresql-8.2-505.jdbc3.jar, hibernate.bytecode.use_reflection_optimizer=false, hibernate.show_sql=true, current_session_context_class=thread, java.vm.specification.version=1.0, java.home=/usr/local/jdk1.6.0_05/jre, sun.arch.data.model=32, hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect, hibernate.connection.url=jdbc:postgresql://localhost:5432/jarf, connection.pool_size=1, user.language=en, java.specification.vendor=Sun Microsystems Inc., java.vm.info=mixed mode, sharing, java.version=1.6.0_05, java.ext.dirs=/usr/local/jdk1.6.0_05/jre/lib/ext:/usr/java/packages/lib/ext, sun.boot.class.path=/usr/local/jdk1.6.0_05/jre/lib/resources.jar:/usr/local/jdk1.6.0_05/jre/lib/rt.jar:/usr/local/jdk1.6.0_05/jre/lib/sunrsasign.jar:/usr/local/jdk1.6.0_05/jre/lib/jsse.jar:/usr/local/jdk1.6.0_05/jre/lib/jce.jar:/usr/local/jdk1.6.0_05/jre/lib/charsets.jar:/usr/local/jdk1.6.0_05/jre/classes, java.vendor=Sun Microsystems Inc., connection.driver_class=org.postgresql.Driver, file.separator=/, java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport.cgi, sun.io.unicode.encoding=UnicodeLittle, sun.cpu.endian=little, connection.url=jdbc:postgresql://localhost:5432/jarf, dialect=org.hibernate.dialect.PostgreSQLDialect, sun.cpu.isalist=} 11:07:44,039 DEBUG SearchConfiguration:56 - Search not present in classpath, ignoring event listener registration 11:07:44,040 DEBUG Configuration:1318 - Preparing to build session factory with filters : {} 11:07:44,040 DEBUG AnnotationConfiguration:248 - Execute first pass mapping processing 11:07:44,561 DEBUG AnnotationConfiguration:512 - Process hbm files 11:07:44,563 DEBUG AnnotationConfiguration:520 - Process annotated classes 11:07:44,575 INFO AnnotationBinder:418 - Binding entity from annotated class: teste.Cliente 11:07:44,613 DEBUG Ejb3Column:161 - Binding column DTYPE. Unique false 11:07:44,651 DEBUG EntityBinder:295 - Import with entity name Cliente 11:07:44,656 INFO EntityBinder:422 - Bind entity teste.Cliente on table cliente 11:07:44,672 DEBUG AnnotationBinder:1022 - Processing teste.Cliente property annotation 11:07:44,714 DEBUG AnnotationBinder:1022 - Processing teste.Cliente field annotation 11:07:44,743 DEBUG AnnotationBinder:1133 - Processing annotations of teste.Cliente.id 11:07:44,753 DEBUG Ejb3Column:161 - Binding column id. Unique false 11:07:44,754 DEBUG AnnotationBinder:1257 - id is an id 11:07:44,784 DEBUG SimpleValueBinder:220 - building SimpleValue for id 11:07:44,789 DEBUG PropertyBinder:127 - Building property id 11:07:44,796 DEBUG AnnotationBinder:1293 - Bind @Id on id 11:07:44,797 DEBUG AnnotationBinder:1133 - Processing annotations of teste.Cliente.idade 11:07:44,798 DEBUG Ejb3Column:161 - Binding column idade_cliente. Unique false 11:07:44,803 DEBUG PropertyBinder:106 - binding property idade with lazy=false 11:07:44,806 DEBUG SimpleValueBinder:220 - building SimpleValue for idade 11:07:44,807 DEBUG PropertyBinder:127 - Building property idade 11:07:44,807 DEBUG AnnotationBinder:1133 - Processing annotations of teste.Cliente.nome 11:07:44,808 DEBUG Ejb3Column:161 - Binding column nome_cliente. Unique false 11:07:44,809 DEBUG PropertyBinder:106 - binding property nome with lazy=false 11:07:44,810 DEBUG SimpleValueBinder:220 - building SimpleValue for nome 11:07:44,810 DEBUG PropertyBinder:127 - Building property nome 11:07:44,814 DEBUG AnnotationConfiguration:387 - processing fk mappings (*ToOne and JoinedSubclass) 11:07:44,819 DEBUG Configuration:1153 - processing extends queue 11:07:44,819 DEBUG Configuration:1157 - processing collection mappings 11:07:44,820 DEBUG Configuration:1168 - processing native query and ResultSetMapping mappings 11:07:44,820 DEBUG Configuration:1176 - processing association property references 11:07:44,821 DEBUG Configuration:1198 - processing foreign key constraints 11:07:44,853 INFO Version:17 - Hibernate Validator 3.1.0.GA 11:07:44,861 DEBUG ClassValidator:177 - ResourceBundle ValidatorMessages not found in Validator classloader. Delegate to org.hibernate.validator.resources.DefaultValidatorMessages 11:07:45,012 INFO DriverManagerConnectionProvider:64 - Using Hibernate built-in connection pool (not for production use!) 11:07:45,014 INFO DriverManagerConnectionProvider:65 - Hibernate connection pool size: 1 11:07:45,015 INFO DriverManagerConnectionProvider:68 - autocommit mode: false 11:07:45,035 INFO DriverManagerConnectionProvider:103 - using driver: org.postgresql.Driver at URL: jdbc:postgresql://localhost:5432/jarf 11:07:45,036 INFO DriverManagerConnectionProvider:106 - connection properties: {user=postgres, password=} 11:07:45,047 DEBUG DriverManagerConnectionProvider:132 - opening new JDBC connection 11:07:45,217 DEBUG DriverManagerConnectionProvider:138 - created connection to: jdbc:postgresql://localhost:5432/jarf, Isolation Level: 2 11:07:45,238 INFO SettingsFactory:116 - RDBMS: PostgreSQL, version: 8.2.4 11:07:45,242 INFO SettingsFactory:117 - JDBC driver: PostgreSQL Native Driver, version: PostgreSQL 8.2 JDBC3 with SSL (build 505) 11:07:45,283 INFO Dialect:175 - Using dialect: org.hibernate.dialect.PostgreSQLDialect 11:07:45,293 INFO TransactionFactoryFactory:59 - Using default transaction strategy (direct JDBC transactions) 11:07:45,297 INFO TransactionManagerLookupFactory:80 - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended) 11:07:45,297 INFO SettingsFactory:170 - Automatic flush during beforeCompletion(): disabled 11:07:45,298 INFO SettingsFactory:174 - Automatic session close at end of transaction: disabled 11:07:45,298 INFO SettingsFactory:181 - JDBC batch size: 15 11:07:45,299 INFO SettingsFactory:184 - JDBC batch updates for versioned data: disabled 11:07:45,300 INFO SettingsFactory:189 - Scrollable result sets: enabled 11:07:45,300 DEBUG SettingsFactory:193 - Wrap result sets: disabled 11:07:45,301 INFO SettingsFactory:197 - JDBC3 getGeneratedKeys(): disabled 11:07:45,301 INFO SettingsFactory:205 - Connection release mode: auto 11:07:45,303 INFO SettingsFactory:232 - Default batch fetch size: 1 11:07:45,303 INFO SettingsFactory:236 - Generate SQL with comments: disabled 11:07:45,304 INFO SettingsFactory:240 - Order SQL updates by primary key: disabled 11:07:45,304 INFO SettingsFactory:244 - Order SQL inserts for batching: disabled 11:07:45,305 INFO SettingsFactory:420 - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory 11:07:45,311 INFO ASTQueryTranslatorFactory:47 - Using ASTQueryTranslatorFactory 11:07:45,311 INFO SettingsFactory:252 - Query language substitutions: {} 11:07:45,312 INFO SettingsFactory:257 - JPA-QL strict compliance: disabled 11:07:45,312 INFO SettingsFactory:262 - Second-level cache: enabled 11:07:45,312 INFO SettingsFactory:266 - Query cache: disabled 11:07:45,323 INFO SettingsFactory:405 - Cache region factory : org.hibernate.cache.impl.bridge.RegionFactoryCacheProviderBridge 11:07:45,324 INFO RegionFactoryCacheProviderBridge:61 - Cache provider: org.hibernate.cache.NoCacheProvider 11:07:45,325 INFO SettingsFactory:276 - Optimize cache for minimal puts: disabled 11:07:45,325 INFO SettingsFactory:285 - Structured second-level cache entries: disabled 11:07:45,356 INFO SettingsFactory:305 - Echoing all SQL to stdout 11:07:45,358 INFO SettingsFactory:314 - Statistics: disabled 11:07:45,358 INFO SettingsFactory:318 - Deleted entity synthetic identifier rollback: disabled 11:07:45,360 INFO SettingsFactory:333 - Default entity-mode: pojo 11:07:45,360 INFO SettingsFactory:337 - Named query checking : enabled 11:07:45,504 DEBUG ClassValidator:177 - ResourceBundle ValidatorMessages not found in Validator classloader. Delegate to org.hibernate.validator.resources.DefaultValidatorMessages 11:07:45,550 INFO SessionFactoryImpl:187 - building session factory 11:07:45,553 DEBUG SessionFactoryImpl:205 - Session factory constructed with filter configurations : {} 11:07:45,554 DEBUG SessionFactoryImpl:209 - instantiating session factory with properties: {java.runtime.name=Java(TM) SE Runtime Environment, hibernate.connection.password=, hibernate.cache.provider_class=org.hibernate.cache.NoCacheProvider, sun.boot.library.path=/usr/local/jdk1.6.0_05/jre/lib/i386, java.vm.version=10.0-b19, hibernate.connection.username=postgres, java.vm.vendor=Sun Microsystems Inc., java.vendor.url=http://java.sun.com/, path.separator=:, java.vm.name=Java HotSpot(TM) Client VM, file.encoding.pkg=sun.io, user.country=US, sun.java.launcher=SUN_STANDARD, sun.os.patch.level=unknown, java.vm.specification.name=Java Virtual Machine Specification, user.dir=/home/Jarf/workspace/teste_hibernate, java.runtime.version=1.6.0_05-b13, java.awt.graphicsenv=sun.awt.X11GraphicsEnvironment, hibernate.current_session_context_class=thread, java.endorsed.dirs=/usr/local/jdk1.6.0_05/jre/lib/endorsed, os.arch=i386, java.io.tmpdir=/tmp, line.separator= , java.vm.specification.vendor=Sun Microsystems Inc., cache.provider_class=org.hibernate.cache.NoCacheProvider, os.name=Linux, sun.jnu.encoding=ISO-8859-1, java.library.path=/usr/local/jdk1.6.0_05/jre/lib/i386/client:/usr/local/jdk1.6.0_05/jre/lib/i386:/usr/local/jdk1.6.0_05/jre/../lib/i386:/usr/local/jdk1.6.0_05/jre/lib/i386/client::/usr/local/jdk1.6.0_05/jre/lib/i386::/usr/lib/seamonkey/:/usr/lib/seamonkey/:/usr/java/packages/lib/i386:/lib:/usr/lib, java.specification.name=Java Platform API Specification, java.class.version=50.0, hibernate.connection.pool_size=1, sun.management.compiler=HotSpot Client Compiler, os.version=2.6.21.5-smp, user.home=/home/Jarf, connection.password=, user.timezone=America/Sao_Paulo, java.awt.printerjob=sun.print.PSPrinterJob, connection.username=postgres, java.specification.version=1.6, file.encoding=ISO-8859-1, hibernate.connection.driver_class=org.postgresql.Driver, show_sql=true, java.class.path=/home/Jarf/workspace/teste_hibernate/bin:/home/Jarf/Hibernate/hibernate-distribution-3.3.1.GA/hibernate3.jar:/home/Jarf/Hibernate/hibernate-distribution-3.3.1.GA/lib/required/antlr-2.7.6.jar:/home/Jarf/Hibernate/hibernate-distribution-3.3.1.GA/lib/required/commons-collections-3.1.jar:/home/Jarf/Hibernate/hibernate-distribution-3.3.1.GA/lib/required/dom4j-1.6.1.jar:/home/Jarf/Hibernate/hibernate-distribution-3.3.1.GA/lib/required/javassist-3.4.GA.jar:/home/Jarf/Hibernate/hibernate-distribution-3.3.1.GA/lib/required/jta-1.1.jar:/home/Jarf/Hibernate/hibernate-distribution-3.3.1.GA/lib/required/slf4j-api-1.5.2.jar:/home/Jarf/Hibernate/hibernate-distribution-3.3.1.GA/lib/bytecode/cglib/hibernate-cglib-repack-2.1_3.jar:/home/Jarf/Hibernate/hibernate-distribution-3.3.1.GA/lib/bytecode/javassist/javassist-3.4.GA.jar:/home/Jarf/Hibernate/hibernate-distribution-3.3.1.GA/lib/optional/c3p0/c3p0-0.9.1.jar:/home/Jarf/Hibernate/hibernate-distribution-3.3.1.GA/lib/optional/ehcache/ehcache-1.2.3.jar:/home/Jarf/Hibernate/hibernate-distribution-3.3.1.GA/lib/optional/jbosscache/jboss-cache-1.4.1.GA.jar:/home/Jarf/Hibernate/hibernate-distribution-3.3.1.GA/lib/optional/jbosscache2/jbosscache-core-2.1.1.GA.jar:/home/Jarf/Hibernate/hibernate-distribution-3.3.1.GA/lib/optional/oscache/oscache-2.1.jar:/home/Jarf/Hibernate/hibernate-distribution-3.3.1.GA/lib/optional/proxool/proxool-0.8.3.jar:/home/Jarf/Hibernate/hibernate-distribution-3.3.1.GA/lib/optional/swarmcache/swarmcache-1.0RC2.jar:/home/Jarf/Hibernate/hibernate-validator-3.1.0.GA/hibernate-validator.jar:/home/Jarf/Hibernate/hibernate-validator-3.1.0.GA/lib/ejb3-persistence.jar:/home/Jarf/Hibernate/hibernate-validator-3.1.0.GA/lib/hibernate-commons-annotations.jar:/home/Jarf/Hibernate/hibernate-validator-3.1.0.GA/lib/hibernate-core.jar:/home/Jarf/Hibernate/hibernate-validator-3.1.0.GA/lib/javassist.jar:/home/Jarf/Hibernate/hibernate-validator-3.1.0.GA/lib/slf4j-api.jar:/home/Jarf/Hibernate/hibernate-validator-3.1.0.GA/lib/build/ant-junit-1.6.5.jar:/home/Jarf/Hibernate/hibernate-validator-3.1.0.GA/lib/build/junit-3.8.1.jar:/home/Jarf/Hibernate/hibernate-validator-3.1.0.GA/lib/test/antlr.jar:/home/Jarf/Hibernate/hibernate-validator-3.1.0.GA/lib/test/asm.jar:/home/Jarf/Hibernate/hibernate-validator-3.1.0.GA/lib/test/asm-attrs.jar:/home/Jarf/Hibernate/hibernate-validator-3.1.0.GA/lib/test/commons-collections.jar:/home/Jarf/Hibernate/hibernate-validator-3.1.0.GA/lib/test/dom4j.jar:/home/Jarf/Hibernate/hibernate-validator-3.1.0.GA/lib/test/hibernate-annotations.jar:/home/Jarf/Hibernate/hibernate-validator-3.1.0.GA/lib/test/hibernate-entitymanager.jar:/home/Jarf/Hibernate/hibernate-validator-3.1.0.GA/lib/test/jta.jar:/home/Jarf/Hibernate/hibernate-validator-3.1.0.GA/lib/test/junit.jar:/home/Jarf/Hibernate/hibernate-validator-3.1.0.GA/lib/test/log4j.jar:/home/Jarf/Hibernate/hibernate-validator-3.1.0.GA/lib/test/slf4j-log4j12.jar:/home/Jarf/Hibernate/hibernate-annotations-3.4.0.GA/hibernate-annotations.jar:/home/Jarf/Hibernate/hibernate-annotations-3.4.0.GA/lib/dom4j.jar:/home/Jarf/Hibernate/hibernate-annotations-3.4.0.GA/lib/ejb3-persistence.jar:/home/Jarf/Hibernate/hibernate-annotations-3.4.0.GA/lib/hibernate-commons-annotations.jar:/home/Jarf/Hibernate/hibernate-annotations-3.4.0.GA/lib/hibernate-core.jar:/home/Jarf/Hibernate/hibernate-annotations-3.4.0.GA/lib/slf4j-api.jar:/home/Jarf/Hibernate/hibernate-annotations-3.4.0.GA/lib/build/ant-contrib-1.0b2.jar:/home/Jarf/Hibernate/hibernate-annotations-3.4.0.GA/lib/build/ant-junit-1.6.5.jar:/home/Jarf/Hibernate/hibernate-annotations-3.4.0.GA/lib/build/junit-3.8.1.jar:/home/Jarf/Hibernate/hibernate-annotations-3.4.0.GA/lib/test/antlr.jar:/home/Jarf/Hibernate/hibernate-annotations-3.4.0.GA/lib/test/asm.jar:/home/Jarf/Hibernate/hibernate-annotations-3.4.0.GA/lib/test/asm-attrs.jar:/home/Jarf/Hibernate/hibernate-annotations-3.4.0.GA/lib/test/commons-collections.jar:/home/Jarf/Hibernate/hibernate-annotations-3.4.0.GA/lib/test/javassist.jar:/home/Jarf/Hibernate/hibernate-annotations-3.4.0.GA/lib/test/jta.jar:/home/Jarf/Hibernate/hibernate-annotations-3.4.0.GA/lib/test/junit.jar:/home/Jarf/Hibernate/hibernate-annotations-3.4.0.GA/lib/test/log4j.jar:/home/Jarf/Hibernate/hibernate-annotations-3.4.0.GA/lib/test/slf4j-log4j12.jar:/usr/local/globus-4.0.6/lib/postgresql-8.2-505.jdbc3.jar, user.name=Jarf, hibernate.bytecode.use_reflection_optimizer=false, hibernate.show_sql=true, current_session_context_class=thread, java.vm.specification.version=1.0, sun.arch.data.model=32, java.home=/usr/local/jdk1.6.0_05/jre, hibernate.connection.url=jdbc:postgresql://localhost:5432/jarf, hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect, java.specification.vendor=Sun Microsystems Inc., user.language=en, connection.pool_size=1, java.vm.info=mixed mode, sharing, java.version=1.6.0_05, java.ext.dirs=/usr/local/jdk1.6.0_05/jre/lib/ext:/usr/java/packages/lib/ext, sun.boot.class.path=/usr/local/jdk1.6.0_05/jre/lib/resources.jar:/usr/local/jdk1.6.0_05/jre/lib/rt.jar:/usr/local/jdk1.6.0_05/jre/lib/sunrsasign.jar:/usr/local/jdk1.6.0_05/jre/lib/jsse.jar:/usr/local/jdk1.6.0_05/jre/lib/jce.jar:/usr/local/jdk1.6.0_05/jre/lib/charsets.jar:/usr/local/jdk1.6.0_05/jre/classes, java.vendor=Sun Microsystems Inc., file.separator=/, connection.driver_class=org.postgresql.Driver, java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport.cgi, sun.cpu.endian=little, sun.io.unicode.encoding=UnicodeLittle, connection.url=jdbc:postgresql://localhost:5432/jarf, sun.cpu.isalist=, dialect=org.hibernate.dialect.PostgreSQLDialect} 11:07:45,912 DEBUG AbstractEntityPersister:2766 - Static SQL for entity: teste.Cliente 11:07:45,913 DEBUG AbstractEntityPersister:2771 - Version select: select id from cliente where id =? 11:07:45,914 DEBUG AbstractEntityPersister:2774 - Snapshot select: select cliente_.id, cliente_.idade_cliente as idade2_0_, cliente_.nome_cliente as nome3_0_ from cliente cliente_ where cliente_.id=? 11:07:45,914 DEBUG AbstractEntityPersister:2777 - Insert 0: insert into cliente (idade_cliente, nome_cliente, id) values (?, ?, ?) 11:07:45,915 DEBUG AbstractEntityPersister:2778 - Update 0: update cliente set idade_cliente=?, nome_cliente=? where id=? 11:07:45,915 DEBUG AbstractEntityPersister:2779 - Delete 0: delete from cliente where id=? 11:07:45,948 DEBUG EntityLoader:102 - Static select for entity teste.Cliente: select cliente0_.id as id0_0_, cliente0_.idade_cliente as idade2_0_0_, cliente0_.nome_cliente as nome3_0_0_ from cliente cliente0_ where cliente0_.id=? 11:07:45,949 DEBUG EntityLoader:102 - Static select for entity teste.Cliente: select cliente0_.id as id0_0_, cliente0_.idade_cliente as idade2_0_0_, cliente0_.nome_cliente as nome3_0_0_ from cliente cliente0_ where cliente0_.id=? 11:07:45,950 DEBUG EntityLoader:102 - Static select for entity teste.Cliente: select cliente0_.id as id0_0_, cliente0_.idade_cliente as idade2_0_0_, cliente0_.nome_cliente as nome3_0_0_ from cliente cliente0_ where cliente0_.id=? for update 11:07:45,953 DEBUG EntityLoader:102 - Static select for entity teste.Cliente: select cliente0_.id as id0_0_, cliente0_.idade_cliente as idade2_0_0_, cliente0_.nome_cliente as nome3_0_0_ from cliente cliente0_ where cliente0_.id=? for update 11:07:45,954 DEBUG EntityLoader:102 - Static select for entity teste.Cliente: select cliente0_.id as id0_0_, cliente0_.idade_cliente as idade2_0_0_, cliente0_.nome_cliente as nome3_0_0_ from cliente cliente0_ where cliente0_.id=? for update 11:07:45,967 DEBUG EntityLoader:57 - Static select for action ACTION_MERGE on entity teste.Cliente: select cliente0_.id as id0_0_, cliente0_.idade_cliente as idade2_0_0_, cliente0_.nome_cliente as nome3_0_0_ from cliente cliente0_ where cliente0_.id=? 11:07:45,968 DEBUG EntityLoader:57 - Static select for action ACTION_REFRESH on entity teste.Cliente: select cliente0_.id as id0_0_, cliente0_.idade_cliente as idade2_0_0_, cliente0_.nome_cliente as nome3_0_0_ from cliente cliente0_ where cliente0_.id=? 11:07:45,984 DEBUG SessionFactoryObjectFactory:62 - initializing class SessionFactoryObjectFactory 11:07:45,986 DEBUG SessionFactoryObjectFactory:99 - registered: 8a8085a31c9efc95011c9efc973c0000 (unnamed) 11:07:45,986 INFO SessionFactoryObjectFactory:105 - Not binding factory to JNDI, no JNDI name configured 11:07:45,987 DEBUG SessionFactoryImpl:340 - instantiated session factory 11:07:45,995 DEBUG SessionFactoryImpl:426 - Checking 0 named HQL queries 11:07:45,996 DEBUG SessionFactoryImpl:446 - Checking 0 named SQL queries 11:07:46,081 DEBUG SessionImpl:247 - opened session at timestamp: [telefone removido] 11:07:46,187 DEBUG JDBCTransaction:82 - begin 11:07:46,188 DEBUG ConnectionManager:444 - opening JDBC connection 11:07:46,192 DEBUG JDBCTransaction:87 - current autocommit status: false 11:07:46,206 DEBUG AbstractBatcher:410 - about to open PreparedStatement (open PreparedStatements: 0, globally: 0) 11:07:46,212 DEBUG SQL:111 - select nextval ('hibernate_sequence') Hibernate: select nextval ('hibernate_sequence') 11:07:46,224 DEBUG AbstractBatcher:418 - about to close PreparedStatement (open PreparedStatements: 1, globally: 1) 11:07:46,230 DEBUG JDBCExceptionReporter:92 - could not get next sequence value [select nextval ('hibernate_sequence')] org.postgresql.util.PSQLException: ERROR: relation "hibernate_sequence" does not exist at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1548) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1316) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:191) at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:452) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:351) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:255) at org.hibernate.id.SequenceGenerator.generate(SequenceGenerator.java:98) at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:122) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:210) at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:56) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:195) at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:50) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:93) at org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:562) at org.hibernate.impl.SessionImpl.save(SessionImpl.java:550) at org.hibernate.impl.SessionImpl.save(SessionImpl.java:546) 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:597) at org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:342) at $Proxy8.save(Unknown Source) at teste.dao.ClienteDAO.salvar(ClienteDAO.java:16) at teste.dao.Principal.main(Principal.java:20) 11:07:46,233 WARN JDBCExceptionReporter:100 - SQL Error: 0, SQLState: 42P01 11:07:46,234 ERROR JDBCExceptionReporter:101 - ERROR: relation "hibernate_sequence" does not exist Exception in thread "main" org.hibernate.exception.SQLGrammarException: could not get next sequence value at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:90) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66) at org.hibernate.id.SequenceGenerator.generate(SequenceGenerator.java:119) at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:122) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:210) at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:56) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:195) at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:50) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:93) at org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:562) at org.hibernate.impl.SessionImpl.save(SessionImpl.java:550) at org.hibernate.impl.SessionImpl.save(SessionImpl.java:546) 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:597) at org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:342) at $Proxy8.save(Unknown Source) at teste.dao.ClienteDAO.salvar(ClienteDAO.java:16) at teste.dao.Principal.main(Principal.java:20) Caused by: org.postgresql.util.PSQLException: ERROR: relation "hibernate_sequence" does not exist at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1548) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1316) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:191) at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:452) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:351) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:255) at org.hibernate.id.SequenceGenerator.generate(SequenceGenerator.java:98) ... 17 more

R

Como estão seus códigos?
Na verdade não todos erros, esse é o log gerado.

Erro que eu vi acho esses 2:

Esse aqui não sei, tenho que ver os códigos

Acho que você esqueceu de colocar @GeneratedValue, junto na chave primária da tabela

J

Eu coloquei sim Rafael ; /

package teste;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

@Entity
@Table(name = "cliente")

public class Cliente implements Serializable {
	
	@Id @GeneratedValue(strategy = GenerationType.AUTO)
	private Long id;
	@Column(name = "nome_cliente", nullable = false, length=60)
	private String nome;
	@Column(name = "idade_cliente", nullable = false, length = 5)
	private Long idade;
	
	public Cliente(){
		
	}
	
	public Long getId() {
		return id;
	}
	private void setId(Long id) {
		this.id = id;
	}
	public String getNome() {
		return nome;
	}
	public void setNome(String nome) {
		this.nome = nome;
	}
	public Long getIdade() {
		return idade;
	}
	public void setIdade(Long idade) {
		this.idade = idade;
	}

}
olha ele aki:
@Id @GeneratedValue(strategy = GenerationType.AUTO)
	private Long id;

:(

M

Bom dia .

Estou com um problema.
Eu criei as tabelas no banco de dados e configurei o hibernante para gerar as classes automaticamente mas quero modificar as tabelas do banco de dados .

Como eu posso fazer a modificação utilizando o mesmo projeto.

Criado 24 de setembro de 2008
Ultima resposta 26 de mai. de 2009
Respostas 32
Participantes 7