Hi
I am new to Hibernate.
Any feedback is higly appreciated .
From the log it appears insertion happened .
But on querying the database , I see no rows have been inserted.
Any idea ??
Hibernate version:2.1.6
Name and version of the database you are using: Oracle 9i
Mapping documents:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN" "http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd"> <hibernate-configuration> <session-factory> <property name="hibernate.connection.url">jdbc:oracle:thin:@localhost:1521:SATORA</property> <property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property> <property name="hibernate.connection.username">scott</property> <property name="hibernate.connection.password">tiger</property> <property name="dialect">net.sf.hibernate.dialect.OracleDialect</property> <property name="hibernate.show_sql">true</property> <mapping resource="src/config/CD.hbm.xml"/> </session-factory> </hibernate-configuration>
<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd"> <hibernate-mapping> <class name="src.java.dao.CD" table="CD"> <id name="id" type="integer" unsaved-value="null" > <column name="id" sql-type="int" not-null="true"/> <generator class="sequence"> <param name="sequence"> seq_cd </param> </generator> </id> <property name="title" type="string" /> <property name="artist" type="string" /> </class> </hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
SessionFactory factory = new Configuration().configure().buildSessionFactory(); Session session = factory.openSession(); CD cd = new CD("Bajan","Singers"); session.save(cd); session.flush(); session.close();
Debug level Hibernate log excerpt:
Jun 16, 2007 11:00:58 PM net.sf.hibernate.cfg.Environment <clinit> INFO: Hibernate 2.1.6 Jun 16, 2007 11:00:58 PM net.sf.hibernate.cfg.Environment <clinit> INFO: hibernate.properties not found Jun 16, 2007 11:00:58 PM net.sf.hibernate.cfg.Environment <clinit> INFO: using CGLIB reflection optimizer Jun 16, 2007 11:00:58 PM net.sf.hibernate.cfg.Configuration configure INFO: configuring from resource: /hibernate.cfg.xml Jun 16, 2007 11:00:58 PM net.sf.hibernate.cfg.Configuration getConfigurationInputStream INFO: Configuration resource: /hibernate.cfg.xml Jun 16, 2007 11:00:58 PM net.sf.hibernate.cfg.Configuration addResource INFO: Mapping resource: src/config/CD.hbm.xml Jun 16, 2007 11:00:58 PM net.sf.hibernate.cfg.Binder bindRootClass INFO: Mapping class: src.java.dao.CD -> CD Jun 16, 2007 11:00:58 PM net.sf.hibernate.cfg.Configuration doConfigure INFO: Configured SessionFactory: null Jun 16, 2007 11:00:58 PM net.sf.hibernate.cfg.Configuration secondPassCompile INFO: processing one-to-many association mappings Jun 16, 2007 11:00:58 PM net.sf.hibernate.cfg.Configuration secondPassCompile INFO: processing one-to-one association property references Jun 16, 2007 11:00:58 PM net.sf.hibernate.cfg.Configuration secondPassCompile INFO: processing foreign key constraints Jun 16, 2007 11:00:58 PM net.sf.hibernate.dialect.Dialect <init> INFO: Using dialect: net.sf.hibernate.dialect.OracleDialect Jun 16, 2007 11:00:58 PM net.sf.hibernate.cfg.SettingsFactory buildSettings INFO: Use outer join fetching: true Jun 16, 2007 11:00:58 PM net.sf.hibernate.connection.DriverManagerConnectionProvider configure INFO: Using Hibernate built-in connection pool (not for production use!) Jun 16, 2007 11:00:58 PM net.sf.hibernate.connection.DriverManagerConnectionProvider configure INFO: Hibernate connection pool size: 20 Jun 16, 2007 11:00:59 PM net.sf.hibernate.connection.DriverManagerConnectionProvider configure INFO: using driver: oracle.jdbc.driver.OracleDriver at URL: jdbc:oracle:thin:@localhost:1521:SATORA Jun 16, 2007 11:00:59 PM net.sf.hibernate.connection.DriverManagerConnectionProvider configure INFO: connection properties: {user=scott, password=tiger} Jun 16, 2007 11:00:59 PM net.sf.hibernate.transaction.TransactionManagerLookupFactory getTransactionManagerLookup INFO: No TransactionManagerLookup configured (in JTA environment, use of process level read-write cache is not recommended) Jun 16, 2007 11:00:59 PM net.sf.hibernate.cfg.SettingsFactory buildSettings INFO: Use scrollable result sets: true Jun 16, 2007 11:00:59 PM net.sf.hibernate.cfg.SettingsFactory buildSettings INFO: Use JDBC3 getGeneratedKeys(): false Jun 16, 2007 11:00:59 PM net.sf.hibernate.cfg.SettingsFactory buildSettings INFO: Optimize cache for minimal puts: false Jun 16, 2007 11:00:59 PM net.sf.hibernate.cfg.SettingsFactory buildSettings INFO: echoing all SQL to stdout Jun 16, 2007 11:00:59 PM net.sf.hibernate.cfg.SettingsFactory buildSettings INFO: Query language substitutions: {} Hibernate: select seq_cd .nextval from dual Jun 16, 2007 11:00:59 PM net.sf.hibernate.cfg.SettingsFactory buildSettings INFO: cache provider: net.sf.hibernate.cache.EhCacheProvider Jun 16, 2007 11:00:59 PM net.sf.hibernate.cfg.Configuration configureCaches INFO: instantiating and configuring caches Jun 16, 2007 11:00:59 PM net.sf.hibernate.impl.SessionFactoryImpl <init> INFO: building session factory Jun 16, 2007 11:01:00 PM net.sf.hibernate.impl.SessionFactoryObjectFactory addInstance INFO: Not binding factory to JNDI, no JNDI name configured Hibernate: insert into CD (title, artist, id) values (?, ?, ?)
|