pessoal
nao estou conseguindo inserir no postgres usando o hibernate
olha o erro que aparece
Hibernate: insert into "Notificacao" ("CHAVE_ACESSO", "DATA_PROCESSAMENTO", "XML", "codigo") values (?, ?, ?, ?)
log4j:WARN No appenders could be found for logger (org.hibernate.cfg.annotations.Version).
log4j:WARN Please initialize the log4j system properly.
Exception in thread "main" org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch update
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:90)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:275)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:266)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:167)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1027)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:365)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:137)
at br.com.notificacao.Teste.main(Teste.java:36)
Caused by: java.sql.BatchUpdateException: Entrada em lote 0 insert into "Notificacao" ("CHAVE_ACESSO", "DATA_PROCESSAMENTO", "XML", "codigo") values (`123`, 2009-06-14 22:56:50.765000 -03:00:00, xmlTeste, 180) foi abortada. Chame getNextException para ver a causa.
at org.postgresql.jdbc2.AbstractJdbc2Statement$BatchResultHandler.handleError(AbstractJdbc2Statement.java:2531)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1344)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:343)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeBatch(AbstractJdbc2Statement.java:2668)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:70)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:268)
vi num outro forum que o problema tinha sido resolvido colocando os nomes dos parametros entre . Fiz o comando no postgres e deu certo usando
.
Olha como mapiei.
[code]//Definindo que a classe será persistida
@Entity
@Table(name="Notificacao
")
public class Notificacao
{
@Id
@GeneratedValue(strategy=GenerationType.SEQUENCE)
@Column(name="`codigo`")
private long codigo;
@Column(name="`DATA_PROCESSAMENTO`")
private Date data;
@Column(name="`CHAVE_ACESSO`")
private String chaveAcesso;
@Column(name="`XML`")
private String xml;[/code]
meu hibernate.cfg.xml
[code]<?xml version="1.0" encoding="utf-8"?>
org.postgresql.Driver jdbc:postgresql://localhost:5432/postgres org.hibernate.dialect.PostgreSQLDialect truepostgres postgres 10 [/code]alguem sabe dizer como resolver isso?