Boa tarde gostaria de saber por que está acontecendo esse erro, o projeto está com todos os jars na lib e no path porem quando vou inserir está me retornando um erro. > Abr 19, 2014 4:49:27 PM org.hibernate.annotations.common.Version > <clinit> INFO: HCANN000001: Hibernate Commons Annotations > {4.0.2.Final} Abr 19, 2014 4:49:27 PM org.hibernate.Version logVersion > INFO: HHH000412: Hibernate Core {4.2.6.Final} Abr 19, 2014 4:49:27 PM > org.hibernate.cfg.Environment <clinit> INFO: HHH000205: Loaded > properties from resource hibernate.properties: > {hibernate.connection.driver_class=org.h2.Driver, > hibernate.dialect=org.hibernate.dialect.H2Dialect, > hibernate.max_fetch_depth=5, hibernate.format_sql=true, > hibernate.generate_statistics=true, hibernate.connection.username=sa, > hibernate.connection.url=jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1;MVCC=TRUE, > hibernate.bytecode.use_reflection_optimizer=false, > hibernate.jdbc.batch_versioned_data=true, > hibernate.connection.pool_size=5} Abr 19, 2014 4:49:28 PM > org.hibernate.cfg.Environment buildBytecodeProvider INFO: HHH000021: > Bytecode provider name : javassist Abr 19, 2014 4:49:29 PM > org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl > configure INFO: HHH000402: Using Hibernate built-in connection pool > (not for production use!) Abr 19, 2014 4:49:29 PM > org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl > configure INFO: HHH000115: Hibernate connection pool size: 5 Abr 19, > 2014 4:49:29 PM > org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl > configure INFO: HHH000006: Autocommit mode: true Abr 19, 2014 4:49:29 > PM > org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl > configure INFO: HHH000401: using driver [org.postgresql.Driver] at URL > [jdbc:postgresql://localhost/postgres] Abr 19, 2014 4:49:29 PM > org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl > configure INFO: HHH000046: Connection properties: {user=postgres, > password=****, autocommit=true, release_mode=auto} Abr 19, 2014 > 4:49:30 PM org.hibernate.dialect.Dialect <init> INFO: HHH000400: Using > dialect: org.hibernate.dialect.PostgreSQLDialect Abr 19, 2014 4:49:30 > PM org.hibernate.engine.jdbc.internal.LobCreatorBuilder > useContextualLobCreation INFO: HHH000423: Disabling contextual LOB > creation as JDBC driver reported JDBC version [3] less than 4 Abr 19, > 2014 4:49:30 PM > org.hibernate.engine.transaction.internal.TransactionFactoryInitiator > initiateService INFO: HHH000268: Transaction strategy: > org.hibernate.engine.transaction.internal.jdbc.JdbcTransactionFactory > Abr 19, 2014 4:49:30 PM > org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory <init> INFO: > HHH000397: Using ASTQueryTranslatorFactory SLF4J: Failed to load class > "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation > (NOP) logger implementation SLF4J: See > http://www.slf4j.org/codes.html#StaticLoggerBinder for further > details. Abr 19, 2014 4:49:31 PM > org.hibernate.cache.spi.UpdateTimestampsCache <init> INFO: HHH000250: > Starting update timestamps cache at region: > org.hibernate.cache.spi.UpdateTimestampsCache Abr 19, 2014 4:49:31 PM > org.hibernate.cache.ehcache.AbstractEhcacheRegionFactory getCache > WARN: HHH020003: Could not find a specific ehcache configuration for > cache named [org.hibernate.cache.spi.UpdateTimestampsCache]; using > defaults. Abr 19, 2014 4:49:31 PM > org.hibernate.cache.internal.StandardQueryCache <init> INFO: > HHH000248: Starting query cache at region: > org.hibernate.cache.internal.StandardQueryCache Abr 19, 2014 4:49:31 > PM org.hibernate.cache.ehcache.AbstractEhcacheRegionFactory getCache > WARN: HHH020003: Could not find a specific ehcache configuration for > cache named [org.hibernate.cache.internal.StandardQueryCache]; using > defaults. Abr 19, 2014 4:49:32 PM > org.hibernate.tool.hbm2ddl.SchemaUpdate execute INFO: HHH000228: > Running hbm2ddl schema update Abr 19, 2014 4:49:32 PM > org.hibernate.tool.hbm2ddl.SchemaUpdate execute INFO: HHH000102: > Fetching database metadata Abr 19, 2014 4:49:32 PM > org.hibernate.tool.hbm2ddl.SchemaUpdate execute INFO: HHH000396: > Updating schema Abr 19, 2014 4:49:32 PM > org.hibernate.tool.hbm2ddl.TableMetadata <init> INFO: HHH000261: Table > found: public.pessoa Abr 19, 2014 4:49:32 PM > org.hibernate.tool.hbm2ddl.TableMetadata <init> INFO: HHH000037: > Columns: [id, idcidade_cidade, cep, id_cliente, idpessoa, nome, > observacoes, endereco] Abr 19, 2014 4:49:32 PM > org.hibernate.tool.hbm2ddl.TableMetadata <init> INFO: HHH000108: > Foreign keys: [cidade_fk] Abr 19, 2014 4:49:32 PM > org.hibernate.tool.hbm2ddl.TableMetadata <init> INFO: HHH000126: > Indexes: [pkidpessoa] Abr 19, 2014 4:49:32 PM > org.hibernate.tool.hbm2ddl.SchemaUpdate execute INFO: HHH000232: > Schema update complete Hibernate: > select > nextval ('hibernate_sequence') Hibernate: > insert > into > pessoa > (nome, id) > values > (?, ?) Abr 19, 2014 4:49:32 PM org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions WARN: > SQL Error: 0, SQLState: 23502 Abr 19, 2014 4:49:32 PM > org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions ERROR: > ERROR: null value in column "endereco" violates not-null constraint > Detalhe: Failing row contains (10, Andrades, null, null, null, null, > 70, null). Exception in thread "main" > javax.persistence.RollbackException: Error while committing the > transaction at > org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:92) at > testeUnitario.TesteConexaoPostgre.main(TesteConexaoPostgre.java:19) > Caused by: javax.persistence.PersistenceException: > org.hibernate.exception.ConstraintViolationException: could not > execute statement at > org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1387) > at > org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1310) > at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:80) > ... 1 more Caused by: > org.hibernate.exception.ConstraintViolationException: could not > execute statement at > org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:129) > at > org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:49) > at > org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:125) > at > org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:110) > at > org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:136) > at > org.hibernate.engine.jdbc.batch.internal.NonBatchingBatch.addToBatch(NonBatchingBatch.java:58) > at > org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3067) > at > org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3509) > at > org.hibernate.action.internal.EntityInsertAction.execute(EntityInsertAction.java:88) > at org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:377) > at > org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:369) > at > org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:286) > at > org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:339) > at > org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:52) > at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1234) > at > org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:404) > at > org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.beforeTransactionCommit(JdbcTransaction.java:101) > at > org.hibernate.engine.transaction.spi.AbstractTransactionImpl.commit(AbstractTransactionImpl.java:175) > at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:75) > ... 1 more Caused by: org.postgresql.util.PSQLException: ERROR: null > value in column "endereco" violates not-null constraint Detalhe: > Failing row contains (10, Andrades, null, null, null, null, 70, null). > at > org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2161) > at > org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1890) > at > org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255) > at > org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:559) > at > org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:417) > at > org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:363) > at > org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:133) > ... 15 more acredito que a implementação esteja correta em minha entidade eu coloquei o seguinte. @Entity @Table(name="pessoa") public class Pessoa implements Serializable{ private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy=GenerationType.SEQUENCE) @Column(name="id") private Long id; public Long getId() { return this.id; } private String nome; //get and set } não consigo compreender por que não insere, no mysql está ocorrendo tudo bem mas no postgresql não está funcionando. minha persistence <?xml version="1.0" encoding="UTF-8"?> <persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"> <persistence-unit name="comunicaVisual" transaction-type="RESOURCE_LOCAL"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <class>entys.Pessoa</class> <exclude-unlisted-classes>true</exclude-unlisted-classes> <properties> <property name="javax.persistence.jdbc.url" value="jdbc:postgresql://localhost/postgres" /> <property name="javax.persistence.jdbc.driver" value="org.postgresql.Driver" /> <property name="javax.persistence.jdbc.user" value="postgres" /> <property name="javax.persistence.jdbc.password" value="1" /> <property name="hibernate.hbm2ddl.auto" value="update" /> <property name="hibernate.show_sql" value="true" /> <property name="hibernate.format_sql" value="true" /> <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect" /> <prop erty name="hibernate.cache.use_query_cache" value="true" /> <property name="hibernate.cache.region.factory_class" value="org.hibernate.cache.ehcache.EhCacheRegionFactory" /> </properties> </persistence-unit> </persistence> a imagem do postre ![inserir a descrição da imagem aqui][1] [1]: https://i.sstatic.net/rO99k.png espero que alguém possa ajudar.