[code]import modelo.LabMedico;
import org.hibernate.Session;
import util.HibernateUtil;
public class AdicionaMedico {
public static void main (String [] args){
Session s = HibernateUtil.getSessionFactory().getCurrentSession();
s.beginTransaction();
LabMedico medico = new LabMedico();
medico.setMedNome("Batore");
medico.setMedStatus("A");
s.save(medico);
s.beginTransaction().commit();
}
}
[/code]
erro
[code]run:
27/03/2011 01:45:45 org.hibernate.cfg.annotations.Version
INFO: Hibernate Annotations 3.3.1.GA
27/03/2011 01:45:45 org.hibernate.cfg.Environment
INFO: Hibernate 3.2.5
27/03/2011 01:45:45 org.hibernate.cfg.Environment
INFO: hibernate.properties not found
27/03/2011 01:45:45 org.hibernate.cfg.Environment buildBytecodeProvider
INFO: Bytecode provider name : cglib
27/03/2011 01:45:45 org.hibernate.cfg.Environment
INFO: using JDK 1.4 java.sql.Timestamp handling
27/03/2011 01:45:45 org.hibernate.cfg.Configuration configure
INFO: configuring from resource: /hibernate.cfg.xml
27/03/2011 01:45:45 org.hibernate.cfg.Configuration getConfigurationInputStream
INFO: Configuration resource: /hibernate.cfg.xml
27/03/2011 01:45:45 org.hibernate.cfg.Configuration addResource
INFO: Reading mappings from resource : modelo/LabMedico.hbm.xml
27/03/2011 01:45:46 org.hibernate.cfg.Configuration addResource
INFO: Reading mappings from resource : modelo/LabPaciente.hbm.xml
27/03/2011 01:45:46 org.hibernate.cfg.Configuration addResource
INFO: Reading mappings from resource : modelo/LabExames.hbm.xml
27/03/2011 01:45:46 org.hibernate.cfg.Configuration doConfigure
INFO: Configured SessionFactory: null
27/03/2011 01:45:46 org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
INFO: Mapping class: modelo.LabMedico -> LabMedico
27/03/2011 01:45:46 org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
INFO: Mapping class: modelo.LabPaciente -> LabPaciente
27/03/2011 01:45:46 org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
INFO: Mapping class: modelo.LabExames -> LabExames
27/03/2011 01:45:46 org.hibernate.cfg.HbmBinder bindCollectionSecondPass
INFO: Mapping collection: modelo.LabMedico.labPacientes -> LabPaciente
27/03/2011 01:45:46 org.hibernate.cfg.HbmBinder bindCollectionSecondPass
INFO: Mapping collection: modelo.LabPaciente.labExameses -> LabExames
27/03/2011 01:45:46 org.hibernate.cfg.AnnotationConfiguration secondPassCompile
INFO: Hibernate Validator not found: ignoring
27/03/2011 01:45:46 org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Using Hibernate built-in connection pool (not for production use!)
27/03/2011 01:45:46 org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Hibernate connection pool size: 20
27/03/2011 01:45:46 org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: autocommit mode: false
27/03/2011 01:45:46 org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: using driver: oracle.jdbc.OracleDriver at URL: jdbc:oracle:thin:@localhost:1521:xe
27/03/2011 01:45:46 org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: connection properties: {user=sislab, password=****}
27/03/2011 01:45:47 org.hibernate.cfg.SettingsFactory buildSettings
INFO: RDBMS: Oracle, version: Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
27/03/2011 01:45:47 org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC driver: Oracle JDBC driver, version: 10.2.0.5.0
27/03/2011 01:45:47 org.hibernate.dialect.Dialect
INFO: Using dialect: org.hibernate.dialect.OracleDialect
27/03/2011 01:45:47 org.hibernate.dialect.Oracle9Dialect
AVISO: The Oracle9Dialect dialect has been deprecated; use either Oracle9iDialect or Oracle10gDialect instead
27/03/2011 01:45:47 org.hibernate.dialect.OracleDialect
AVISO: The OracleDialect dialect has been deprecated; use Oracle8iDialect instead
27/03/2011 01:45:47 org.hibernate.transaction.TransactionFactoryFactory buildTransactionFactory
INFO: Using default transaction strategy (direct JDBC transactions)
27/03/2011 01:45:47 org.hibernate.transaction.TransactionManagerLookupFactory getTransactionManagerLookup
INFO: No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
27/03/2011 01:45:47 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Automatic flush during beforeCompletion(): disabled
27/03/2011 01:45:47 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Automatic session close at end of transaction: disabled
27/03/2011 01:45:47 org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC batch size: 15
27/03/2011 01:45:47 org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC batch updates for versioned data: disabled
27/03/2011 01:45:47 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Scrollable result sets: enabled
27/03/2011 01:45:47 org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC3 getGeneratedKeys(): disabled
27/03/2011 01:45:47 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Connection release mode: auto
27/03/2011 01:45:47 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Default batch fetch size: 1
27/03/2011 01:45:47 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Generate SQL with comments: disabled
27/03/2011 01:45:47 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Order SQL updates by primary key: disabled
27/03/2011 01:45:47 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Order SQL inserts for batching: disabled
27/03/2011 01:45:47 org.hibernate.cfg.SettingsFactory createQueryTranslatorFactory
INFO: Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
27/03/2011 01:45:47 org.hibernate.hql.ast.ASTQueryTranslatorFactory
INFO: Using ASTQueryTranslatorFactory
27/03/2011 01:45:47 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Query language substitutions: {}
27/03/2011 01:45:47 org.hibernate.cfg.SettingsFactory buildSettings
INFO: JPA-QL strict compliance: disabled
27/03/2011 01:45:47 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Second-level cache: enabled
27/03/2011 01:45:47 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Query cache: disabled
27/03/2011 01:45:47 org.hibernate.cfg.SettingsFactory createCacheProvider
INFO: Cache provider: org.hibernate.cache.NoCacheProvider
27/03/2011 01:45:47 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Optimize cache for minimal puts: disabled
27/03/2011 01:45:47 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Structured second-level cache entries: disabled
27/03/2011 01:45:47 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Statistics: disabled
27/03/2011 01:45:47 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Deleted entity synthetic identifier rollback: disabled
27/03/2011 01:45:47 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Default entity-mode: pojo
27/03/2011 01:45:47 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Named query checking : enabled
27/03/2011 01:45:47 org.hibernate.impl.SessionFactoryImpl
INFO: building session factory
27/03/2011 01:45:48 org.hibernate.impl.SessionFactoryObjectFactory addInstance
INFO: Not binding factory to JNDI, no JNDI name configured
27/03/2011 01:45:49 org.hibernate.util.JDBCExceptionReporter logExceptions
AVISO: SQL Error: 942, SQLState: 42000
27/03/2011 01:45:49 org.hibernate.util.JDBCExceptionReporter logExceptions
GRAVE: ORA-00942: a tabela ou view não existe
27/03/2011 01:45:49 org.hibernate.util.JDBCExceptionReporter logExceptions
AVISO: SQL Error: 942, SQLState: 42000
27/03/2011 01:45:49 org.hibernate.util.JDBCExceptionReporter logExceptions
GRAVE: ORA-00942: a tabela ou view não existe
27/03/2011 01:45:49 org.hibernate.event.def.AbstractFlushingEventListener performExecutions
GRAVE: Could not synchronize database state with session
org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch update
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:253)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:237)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:141)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
at AdicionaMedico.main(AdicionaMedico.java:17)
Caused by: java.sql.BatchUpdateException: ORA-00942: a tabela ou view não existe
at oracle.jdbc.driver.DatabaseError.throwBatchUpdateException(DatabaseError.java:344)
at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:10844)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:48)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:246)
... 8 more
Exception in thread “main” org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch update
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:253)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:237)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:141)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
at AdicionaMedico.main(AdicionaMedico.java:17)
Caused by: java.sql.BatchUpdateException: ORA-00942: a tabela ou view não existe
at oracle.jdbc.driver.DatabaseError.throwBatchUpdateException(DatabaseError.java:344)
at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:10844)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:48)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:246)
... 8 more
Java Result: 1
CONSTRUÍDO COM SUCESSO (tempo total: 4 segundos)
[/code]