I have a problem with INSERTing a record in the Oracle database.
Version: Hibernate 2.1, Oracle 9.2:
Please see the Mapping file and the Logs for more information. Though the log dosn't show any exception but somehow it also dosn't perform the Insert.
The Mapping file perfectly maps the underlying table (CAS_TABLE). You can notice their are no Exceptions.
Mapping document(Cassette.hbm.xml) -- Generated by Middlegen:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >
<hibernate-mapping>
<class
name="com.tsystems.ecm.imaes.imadb.hibernate2.archive.Cassette"
table="CAS_TABLE"
>
<meta attribute="class-description" inherit="false">
@hibernate.class
table="CAS_TABLE"
</meta>
<composite-id>
<meta attribute="field-description" inherit="false">
@hibernate.id
generator-class="assigned"
</meta>
<key-property
name="casId"
column="CAS_ID"
type="java.lang.String"
length="10"
>
<meta attribute="field-description">
@hibernate.property
column="CAS_ID"
</meta>
</key-property>
<key-property
name="casType"
column="CAS_TYPE"
type="java.lang.String"
length="6"
>
<meta attribute="field-description">
@hibernate.property
column="CAS_TYPE"
</meta>
</key-property>
<key-property
name="casStatus"
column="CAS_STATUS"
type="java.lang.String"
length="1"
>
<meta attribute="field-description">
@hibernate.property
column="CAS_STATUS"
</meta>
</key-property>
<key-property
name="casCopyid"
column="CAS_COPYID"
type="java.lang.String"
length="10"
>
<meta attribute="field-description">
@hibernate.property
column="CAS_COPYID"
</meta>
</key-property>
<key-property
name="casIsdIdRef"
column="CAS_ISD_ID_REF"
type="java.lang.String"
length="8"
>
<meta attribute="field-description">
@hibernate.property
column="CAS_ISD_ID_REF"
</meta>
</key-property>
<key-property
name="casAdr"
column="CAS_ADR"
type="java.lang.String"
length="120"
>
<meta attribute="field-description">
@hibernate.property
column="CAS_ADR"
</meta>
</key-property>
<key-property
name="casCreate"
column="CAS_CREATE"
type="java.sql.Timestamp"
length="7"
>
<meta attribute="field-description">
@hibernate.property
column="CAS_CREATE"
</meta>
</key-property>
<key-property
name="casSpec"
column="CAS_SPEC"
type="java.lang.String"
length="10"
>
<meta attribute="field-description">
@hibernate.property
column="CAS_SPEC"
</meta>
</key-property>
<key-property
name="casSoft"
column="CAS_SOFT"
type="java.lang.Integer"
length="1"
>
<meta attribute="field-description">
@hibernate.property
column="CAS_SOFT"
</meta>
</key-property>
<key-property
name="casLeft"
column="CAS_LEFT"
type="java.lang.String"
length="8"
>
<meta attribute="field-description">
@hibernate.property
column="CAS_LEFT"
</meta>
</key-property>
<key-property
name="casHighest"
column="CAS_HIGHEST"
type="java.lang.String"
length="12"
>
<meta attribute="field-description">
@hibernate.property
column="CAS_HIGHEST"
</meta>
</key-property>
<key-property
name="casService"
column="CAS_SERVICE"
type="java.lang.String"
length="20"
>
<meta attribute="field-description">
@hibernate.property
column="CAS_SERVICE"
</meta>
</key-property>
<key-property
name="casDsm"
column="CAS_DSM"
type="java.lang.String"
length="20"
>
<meta attribute="field-description">
@hibernate.property
column="CAS_DSM"
</meta>
</key-property>
<key-property
name="casParam"
column="CAS_PARAM"
type="java.lang.String"
length="254"
>
<meta attribute="field-description">
@hibernate.property
column="CAS_PARAM"
</meta>
</key-property>
</composite-id>
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
try {
System.out.println("Saving the record...");
Session session = HibernateSession.currentSession();
/* Old Code
session.saveOrUpdate(obj);
session.flush();
session.connection().commit();
Old code ends here*/
// New code
Transaction tx = session.beginTransaction();
session.saveOrUpdate(obj);
tx.commit();
// New code ends here
System.out.println("Saved...");
}
Full stack trace of any exception that occurs:
NO Exceptions
The generated SQL (show_sql=true):
Saving the record...
INFO cfg.Environment - Hibernate 2.1.2
INFO cfg.Environment - loaded properties from resource hibernate.properties: {hibernate.connection.username=xxxxxx, hibernate.connection.password=xxxxxx, hibernate.cglib.use_reflection_optimizer=true, hibernate.dialect=net.sf.hibernate.dialect.Oracle9Dialect, hibernate.show_sql=true, hibernate.connection.url=jdbc:oracle:thin:@10.251.105.185:1521:db9, hibernate.connection.driver_class=oracle.jdbc.driver.OracleDriver}
INFO cfg.Environment - using CGLIB reflection optimizer
INFO cfg.Configuration - Mapping resource: com/tsystems/ecm/imaes/imadb/hibernate2/archive/Cassette.hbm.xml
DEBUG util.DTDEntityResolver - trying to locate
http://hibernate.sourceforge.net/hibern ... ng-2.0.dtd in classpath under net/sf/hibernate/
DEBUG util.DTDEntityResolver - found
http://hibernate.sourceforge.net/hibern ... ng-2.0.dtd in classpath
INFO cfg.Binder - Mapping class: com.tsystems.ecm.imaes.imadb.hibernate2.archive.Cassette -> CAS_TABLE
DEBUG cfg.Binder - Mapped property: casId -> CAS_ID, type: string
DEBUG cfg.Binder - Mapped property: casType -> CAS_TYPE, type: string
DEBUG cfg.Binder - Mapped property: casStatus -> CAS_STATUS, type: string
DEBUG cfg.Binder - Mapped property: casCopyid -> CAS_COPYID, type: string
DEBUG cfg.Binder - Mapped property: casIsdIdRef -> CAS_ISD_ID_REF, type: string
DEBUG cfg.Binder - Mapped property: casAdr -> CAS_ADR, type: string
DEBUG cfg.Binder - Mapped property: casCreate -> CAS_CREATE, type: timestamp
DEBUG cfg.Binder - Mapped property: casSpec -> CAS_SPEC, type: string
DEBUG cfg.Binder - Mapped property: casSoft -> CAS_SOFT, type: integer
DEBUG cfg.Binder - Mapped property: casLeft -> CAS_LEFT, type: string
DEBUG cfg.Binder - Mapped property: casHighest -> CAS_HIGHEST, type: string
DEBUG cfg.Binder - Mapped property: casService -> CAS_SERVICE, type: string
DEBUG cfg.Binder - Mapped property: casDsm -> CAS_DSM, type: string
DEBUG cfg.Binder - Mapped property: casParam -> CAS_PARAM, type: string
INFO dialect.Dialect - Using dialect: net.sf.hibernate.dialect.Oracle9Dialect
INFO cfg.SettingsFactory - Use outer join fetching: true
INFO connection.DriverManagerConnectionProvider - Using Hibernate built-in connection pool (not for production use!)
INFO connection.DriverManagerConnectionProvider - Hibernate connection pool size: 20
INFO connection.DriverManagerConnectionProvider - using driver: oracle.jdbc.driver.OracleDriver at URL: jdbc:oracle:thin:@10.251.105.185:1521:db9
INFO connection.DriverManagerConnectionProvider - connection properties: {user=temptoadm, password=admtempto}
INFO transaction.TransactionManagerLookupFactory - No TransactionManagerLookup configured (in JTA environment, use of process level read-write cache is not recommended)
DEBUG connection.DriverManagerConnectionProvider - total checked-out connections: 0
DEBUG connection.DriverManagerConnectionProvider - opening new JDBC connection
DEBUG connection.DriverManagerConnectionProvider - created connection to: jdbc:oracle:thin:@10.251.105.185:1521:db9, Isolation Level: 2
DEBUG connection.DriverManagerConnectionProvider - returning connection to pool, pool size: 1
INFO cfg.SettingsFactory - Use scrollable result sets: true
INFO cfg.SettingsFactory - Use JDBC3 getGeneratedKeys(): false
INFO cfg.SettingsFactory - Optimize cache for minimal puts: false
INFO cfg.SettingsFactory - echoing all SQL to stdout
INFO cfg.SettingsFactory - Query language substitutions: {}
INFO cfg.SettingsFactory - cache provider: net.sf.ehcache.hibernate.Provider
INFO cfg.Configuration - instantiating and configuring caches
INFO impl.SessionFactoryImpl - building session factory
DEBUG impl.SessionFactoryImpl - instantiating session factory with properties: {java.runtime.name=Java(TM) 2 Runtime Environment, Standard Edition, hibernate.connection.password=admtempto, sun.boot.library.path=C:\j2sdk1.4.2_07\jre\bin, java.vm.version=1.4.2_07-b05, hibernate.connection.username=temptoadm, java.vm.vendor=Sun Microsystems Inc., java.vendor.url=http://java.sun.com/, path.separator=;, java.vm.name=Java HotSpot(TM) Client VM, file.encoding.pkg=sun.io, user.country=US, sun.os.patch.level=Service Pack 2, java.vm.specification.name=Java Virtual Machine Specification, user.dir=C:\Softwares\eclipse\ImaDAOTest, java.runtime.version=1.4.2_07-b05, java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment, java.endorsed.dirs=C:\j2sdk1.4.2_07\jre\lib\endorsed, os.arch=x86, java.io.tmpdir=C:\DOCUME~1\mshaikh\LOCALS~1\Temp\, line.separator=
, java.vm.specification.vendor=Sun Microsystems Inc., user.variant=, os.name=Windows XP, sun.java2d.fontpath=, java.library.path=C:\j2sdk1.4.2_07\bin;.;C:\WINDOWS\system32;C:\WINDOWS;C:\Program Files\MKS\IntegrityClient\bin;C:\oracle\ora92\bin;C:\Program Files\Common Files\NetSarang;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\Downloaded Program Files;C:\IBMTOOLS\Python22;C:\Program Files\PC-Doctor for Windows\services;C:\Program Files\SlickEdit\win;C:\Program Files\Microsoft Visual Studio\Common\Tools\WinNT;C:\Program Files\Microsoft Visual Studio\Common\MSDev98\Bin;C:\Program Files\Microsoft Visual Studio\Common\Tools;C:\Program Files\Microsoft Visual Studio\VC98\bin;C:\Program Files\MKS\IntegrityClient\bin;C:\oracle\ora92\bin;C:\Program Files\Common Files\NetSarang;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\j2sdk1.4.2_07\bin;C:\Maven 1.0.2\bin;C:\apache-ant-1.6.1\bin, java.specification.name=Java Platform API Specification, java.class.version=48.0, java.util.prefs.PreferencesFactory=java.util.prefs.WindowsPreferencesFactory, os.version=5.1, user.home=C:\Documents and Settings\mshaikh, user.timezone=, java.awt.printerjob=sun.awt.windows.WPrinterJob, file.encoding=Cp1252, java.specification.version=1.4, hibernate.connection.driver_class=oracle.jdbc.driver.OracleDriver, java.class.path=C:\Softwares\eclipse\ImaDAOTest;C:\hibernate_intro\lib\cglib-2.0-rc2.jar;C:\hibernate_intro\lib\commons-collections-2.1.jar;C:\hibernate_intro\lib\commons-lang-1.0.1.jar;C:\hibernate_intro\lib\commons-logging-1.0.3.jar;C:\hibernate_intro\lib\dom4j-1.4.jar;C:\hibernate_intro\lib\ehcache-0.6.jar;C:\hibernate_intro\lib\hibernate2.jar;C:\hibernate_intro\lib\hibernate-tools.jar;C:\hibernate_intro\lib\jdbc2_0-stdext.jar;C:\hibernate_intro\lib\jdom.jar;C:\hibernate_intro\lib\jta.jar;C:\hibernate_intro\lib\junit-3.8.1.jar;C:\hibernate_intro\lib\odmg-3.0.jar;C:\hibernate_intro\lib\pg74.1jdbc3.jar;C:\hibernate_intro\lib\xalan-2.4.0.jar;C:\Softwares\eclipse\ImaDAOTest\lib\classes12.jar;C:\Softwares\eclipse\ImaDAOTest\lib\log4j-1.2.8.jar, user.name=mshaikh, hibernate.show_sql=true, java.vm.specification.version=1.0, java.home=C:\j2sdk1.4.2_07\jre, sun.arch.data.model=32, hibernate.dialect=net.sf.hibernate.dialect.Oracle9Dialect, hibernate.connection.url=jdbc:oracle:thin:@10.251.105.185:1521:db9, user.language=en, java.specification.vendor=Sun Microsystems Inc., awt.toolkit=sun.awt.windows.WToolkit, hibernate.cglib.use_reflection_optimizer=true, java.vm.info=mixed mode, java.version=1.4.2_07, java.ext.dirs=C:\j2sdk1.4.2_07\jre\lib\ext, sun.boot.class.path=C:\j2sdk1.4.2_07\jre\lib\rt.jar;C:\j2sdk1.4.2_07\jre\lib\i18n.jar;C:\j2sdk1.4.2_07\jre\lib\sunrsasign.jar;C:\j2sdk1.4.2_07\jre\lib\jsse.jar;C:\j2sdk1.4.2_07\jre\lib\jce.jar;C:\j2sdk1.4.2_07\jre\lib\charsets.jar;C:\j2sdk1.4.2_07\jre\classes, java.vendor=Sun Microsystems Inc., file.separator=\, java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport.cgi, sun.io.unicode.encoding=UnicodeLittle, sun.cpu.endian=little, sun.cpu.isalist=pentium i486 i386}
DEBUG impl.SessionFactoryObjectFactory - initializing class SessionFactoryObjectFactory
DEBUG impl.SessionFactoryObjectFactory - registered: 8a99f3a904c25ca90104c25caa650000 (unnamed)
INFO impl.SessionFactoryObjectFactory - no JNDI name configured
DEBUG impl.SessionFactoryImpl - instantiated session factory
DEBUG impl.SessionImpl - opened session
DEBUG transaction.JDBCTransaction - begin
DEBUG connection.DriverManagerConnectionProvider - total checked-out connections: 0
DEBUG connection.DriverManagerConnectionProvider - using pooled JDBC connection, pool size: 0
DEBUG transaction.JDBCTransaction - current autocommit status:false
DEBUG engine.Cascades - id unsaved-value strategy NONE
DEBUG impl.SessionImpl - saveOrUpdate() previously saved instance with id: com.tsystems.ecm.imaes.imadb.hibernate2.archive.Cassette@1829e6f[casId=Test123,casType=Test,casStatus=Test,casCopyid=Test,casIsdIdRef=Test,casAdr=Test,casCreate=Tue Jun 28 15:22:28 IST 2005,casSpec=Test,casSoft=1,casLeft=Test,casHighest=Test,casService=Test,casDsm=Test,casParam=Test]
DEBUG impl.SessionImpl - updating
[com.tsystems.ecm.imaes.imadb.hibernate2.archive.Cassette#com.tsystems.ecm.imaes.imadb.hibernate2.archive.Cassette@1829e6f[casId=Test123,casType=Test,casStatus=Test,casCopyid=Test,casIsdIdRef=Test,casAdr=Test,casCreate=Tue Jun 28 15:22:28 IST 2005,casSpec=Test,casSoft=1,casLeft=Test,casHighest=Test,casService=Test,casDsm=Test,casParam=Test]]
DEBUG transaction.JDBCTransaction - commit
DEBUG impl.SessionImpl - flushing session
DEBUG impl.SessionImpl - Flushing entities and processing referenced collections
DEBUG impl.SessionImpl - Updating entity: [com.tsystems.ecm.imaes.imadb.hibernate2.archive.Cassette#com.tsystems.ecm.imaes.imadb.hibernate2.archive.Cassette@1829e6f[casId=Test123,casType=Test,casStatus=Test,casCopyid=Test,casIsdIdRef=Test,casAdr=Test,casCreate=Tue Jun 28 15:22:28 IST 2005,casSpec=Test,casSoft=1,casLeft=Test,casHighest=Test,casService=Test,casDsm=Test,casParam=Test]]
DEBUG impl.SessionImpl - Processing unreferenced collections
DEBUG impl.SessionImpl - Scheduling collection removes/(re)creates/updates
DEBUG impl.SessionImpl - Flushed: 0 insertions, 1 updates, 0 deletions to 1 objects
DEBUG impl.SessionImpl - Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
DEBUG impl.Printer - listing entities:
DEBUG impl.Printer - com.tsystems.ecm.imaes.imadb.hibernate2.archive.Cassette{}
DEBUG impl.SessionImpl - executing flush
DEBUG persister.EntityPersister - Updating entity: [com.tsystems.ecm.imaes.imadb.hibernate2.archive.Cassette#com.tsystems.ecm.imaes.imadb.hibernate2.archive.Cassette@1829e6f[casId=Test123,casType=Test,casStatus=Test,casCopyid=Test,casIsdIdRef=Test,casAdr=Test,casCreate=Tue Jun 28 15:22:28 IST 2005,casSpec=Test,casSoft=1,casLeft=Test,casHighest=Test,casService=Test,casDsm=Test,casParam=Test]]
DEBUG impl.SessionImpl - post flush
DEBUG impl.SessionImpl - transaction completion
Saved...
DEBUG impl.SessionImpl - closing session
DEBUG impl.SessionImpl - disconnecting session
DEBUG connection.DriverManagerConnectionProvider - returning connection to pool, pool size: 1
DEBUG impl.SessionImpl - transaction completion