Salve!
Pessoal, estou utilizando a configuração automática do hibernate do netbeans. Quando vou gravar um objeto, ele não dá erro no hibernate, chega a retornar o número da sequence,
mas não insere nada no banco de dados!!!
Vou colocar os códigos abaixo:
factory = HibernateUtil.getSessionFactory();
public Object insert(Object c) throws Exception {
Session session = factory.openSession();
System.out.println("----------------------------------------Sessao aberta");
session.save((LinhaLivroCaixa)c);
System.out.println("---------------------------------------------Salvo");
Object chave = session.merge(c);
session.flush();
session.close();
return chave;
}
<?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>
<property name="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</property>
<property name="hibernate.connection.driver_class">org.postgresql.Driver</property>
<property name="hibernate.connection.url">jdbc:postgresql://127.0.0.1:5432/financas</property>
<property name="hibernate.connection.username">xx</property>
<property name="hibernate.connection.password">xxxxxx</property>
<mapping resource="tesouraria/modelo/objetos/LinhaLivroCaixa.hbm.xml"/>
</session-factory>
</hibernate-configuration>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-reverse-engineering PUBLIC "-//Hibernate/Hibernate Reverse Engineering DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-reverse-engineering-3.0.dtd">
<hibernate-reverse-engineering>
<schema-selection match-catalog="financas"/>
<table-filter match-name="linha_livro_caixa"/>
</hibernate-reverse-engineering>
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated 02/02/2013 15:35:40 by Hibernate Tools 3.2.1.GA -->
<hibernate-mapping>
<class name="tesouraria.modelo.objetos.LinhaLivroCaixa" table="linha_livro_caixa" schema="livros">
<id name="id" type="int">
<column name="id" />
<generator class="sequence"><param name="sequence">livros.id_linha_receita</param></generator>
</id>
<property name="horario" type="timestamp">
<column name="horario" length="35" />
</property>
<property name="valor" type="java.lang.Double">
<column name="valor" precision="17" scale="17" />
</property>
<property name="tipoForma" type="java.lang.Integer">
<column name="tipo_forma" />
</property>
<property name="receita" type="java.lang.Integer">
<column name="receita" />
</property>
<property name="origem" type="java.lang.Integer">
<column name="origem" />
</property>
<property name="dc" type="java.lang.Character">
<column name="dc" length="1" />
</property>
<property name="saldoDiario" type="java.lang.Double">
<column name="saldo_diario" precision="17" scale="17" />
</property>
<property name="saldoMensal" type="java.lang.Double">
<column name="saldo_mensal" precision="17" scale="17" />
</property>
<property name="saldoAnual" type="java.lang.Double">
<column name="saldo_anual" precision="17" scale="17" />
</property>
<property name="historico" type="string">
<column name="historico" />
</property>
</class>
</hibernate-mapping>
03/02/2013 11:24:57 org.hibernate.cfg.annotations.Version <clinit>
INFO: Hibernate Annotations 3.3.1.GA
03/02/2013 11:24:57 org.hibernate.cfg.Environment <clinit>
INFO: Hibernate 3.2.5
03/02/2013 11:24:57 org.hibernate.cfg.Environment <clinit>
INFO: hibernate.properties not found
03/02/2013 11:24:57 org.hibernate.cfg.Environment buildBytecodeProvider
INFO: Bytecode provider name : cglib
03/02/2013 11:24:57 org.hibernate.cfg.Environment <clinit>
INFO: using JDK 1.4 java.sql.Timestamp handling
03/02/2013 11:24:57 org.hibernate.cfg.Configuration configure
INFO: configuring from resource: /hibernate.cfg.xml
03/02/2013 11:24:57 org.hibernate.cfg.Configuration getConfigurationInputStream
INFO: Configuration resource: /hibernate.cfg.xml
03/02/2013 11:24:58 org.hibernate.cfg.Configuration addResource
INFO: Reading mappings from resource : tesouraria/modelo/objetos/LinhaLivroCaixa.hbm.xml
03/02/2013 11:24:58 org.hibernate.cfg.Configuration doConfigure
INFO: Configured SessionFactory: null
03/02/2013 11:24:58 org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
INFO: Mapping class: tesouraria.modelo.objetos.LinhaLivroCaixa -> linha_livro_caixa
03/02/2013 11:24:58 org.hibernate.cfg.AnnotationConfiguration secondPassCompile
INFO: Hibernate Validator not found: ignoring
03/02/2013 11:24:58 org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Using Hibernate built-in connection pool (not for production use!)
03/02/2013 11:24:58 org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Hibernate connection pool size: 20
03/02/2013 11:24:58 org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: autocommit mode: false
03/02/2013 11:24:58 org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: using driver: org.postgresql.Driver at URL: jdbc:postgresql://127.0.0.1:5432/financas
03/02/2013 11:24:58 org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: connection properties: {user=php, password=****}
03/02/2013 11:24:58 org.hibernate.cfg.SettingsFactory buildSettings
INFO: RDBMS: PostgreSQL, version: 9.1.7
03/02/2013 11:24:58 org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC driver: PostgreSQL Native Driver, version: PostgreSQL 9.0 JDBC4 (build 801)
03/02/2013 11:24:58 org.hibernate.dialect.Dialect <init>
INFO: Using dialect: org.hibernate.dialect.PostgreSQLDialect
03/02/2013 11:24:58 org.hibernate.transaction.TransactionFactoryFactory buildTransactionFactory
INFO: Using default transaction strategy (direct JDBC transactions)
03/02/2013 11:24:58 org.hibernate.transaction.TransactionManagerLookupFactory getTransactionManagerLookup
INFO: No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
03/02/2013 11:24:58 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Automatic flush during beforeCompletion(): disabled
03/02/2013 11:24:58 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Automatic session close at end of transaction: disabled
03/02/2013 11:24:58 org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC batch size: 15
03/02/2013 11:24:58 org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC batch updates for versioned data: disabled
03/02/2013 11:24:58 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Scrollable result sets: enabled
03/02/2013 11:24:58 org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC3 getGeneratedKeys(): enabled
03/02/2013 11:24:58 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Connection release mode: auto
03/02/2013 11:24:58 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Default batch fetch size: 1
03/02/2013 11:24:58 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Generate SQL with comments: disabled
03/02/2013 11:24:58 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Order SQL updates by primary key: disabled
03/02/2013 11:24:58 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Order SQL inserts for batching: disabled
03/02/2013 11:24:58 org.hibernate.cfg.SettingsFactory createQueryTranslatorFactory
INFO: Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
03/02/2013 11:24:58 org.hibernate.hql.ast.ASTQueryTranslatorFactory <init>
INFO: Using ASTQueryTranslatorFactory
03/02/2013 11:24:58 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Query language substitutions: {}
03/02/2013 11:24:58 org.hibernate.cfg.SettingsFactory buildSettings
INFO: JPA-QL strict compliance: disabled
03/02/2013 11:24:58 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Second-level cache: enabled
03/02/2013 11:24:58 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Query cache: disabled
03/02/2013 11:24:58 org.hibernate.cfg.SettingsFactory createCacheProvider
INFO: Cache provider: org.hibernate.cache.NoCacheProvider
03/02/2013 11:24:58 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Optimize cache for minimal puts: disabled
03/02/2013 11:24:58 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Structured second-level cache entries: disabled
03/02/2013 11:24:58 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Statistics: disabled
03/02/2013 11:24:58 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Deleted entity synthetic identifier rollback: disabled
03/02/2013 11:24:58 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Default entity-mode: pojo
03/02/2013 11:24:58 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Named query checking : enabled
03/02/2013 11:24:58 org.hibernate.impl.SessionFactoryImpl <init>
INFO: building session factory
03/02/2013 11:24:59 org.hibernate.impl.SessionFactoryObjectFactory addInstance
INFO: Not binding factory to JNDI, no JNDI name configured
----------------------------------------Sessao aberta
---------------------------------------------Salvo
id do objeto inserido: 12