-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Error when trying to inser into ORACLE (only using ODBC)
PostPosted: Wed Feb 25, 2009 3:40 pm 
Newbie

Joined: Wed Feb 25, 2009 12:45 pm
Posts: 1
I'm having trouble trying to persist a class in Oracle 11, usgin ODBC (ODBC driver provided by Oracle, same version). However, we found no problem with this same operation when using the native Oracle connector nor the OleDB Oracle connector.

Belows you may find all kind of related information, engine version, connector version, nHibernate version, mapping document, oracle describe for the problematic table, and nHibernate logs (only what's related).

I've been through all of this but still cannot find an answer.
Any help apreciated!

Thanks in advance!
Máximo Besteiro

Hibernate version: 1.2.1.4000

Mapping documents:
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
   <class name="Asterion.Data.DB.LaunchedReportInfo, Asterion.Data.DB" table="launchedreports" lazy ="false">

    <id
      name="UniqueId"
      type ="string">
      <column name="uniqueId"
              sql-type="char(36)" />
      <generator class ="assigned" />
    </id>

    <property
      name="Launched"
      not-null="true">
      <column name="launched"
              sql-type="char(26)" />
    </property>

    <property
      name="Records"
      column="records"
      not-null="true"/>

    <property
      name="RecordsRead"
      column="recordsread"
      not-null="true"/>

    <!--<property
      name="Finished"
      column="finished"/>-->
    <property
      name="ElapsedSeconds"
      column="elapsedSeconds"
      not-null="true"/>

    <property
      name="DeletionDate">
      <column name="deletionDate"
              sql-type="char(16)" />
    </property>

    <many-to-one
      name="Report"
      class ="Asterion.Data.DB.ReportInfo, Asterion.Data.DB">
      <!--cascade="all">-->

      <column name="report"
              not-null="true"
              sql-type="char(36)" />
    </many-to-one>

    <many-to-one
      name="LaunchedBy"
      class ="Asterion.Data.DB.UserInfo, Asterion.Data.DB"
      cascade="none">
      <column name="launchedby"             
              not-null="true"
              sql-type="varchar(100)" />
    </many-to-one>
   
  </class>
</hibernate-mapping>


Oracle describe for the problematic table:
Describe de la tabla en Oracle:
--------------------------------------------
desc launchedreports
Name Null
Type
------------------------------ --------
--------------------------------------------------------------------------- --------------------------------------------------------------------------- ---------------------------------------
UNIQUEID NOT NULL CHAR
(36)
LAUNCHED CHAR
(26)
RECORDS NOT NULL NUMBER
(20)
RECORDSREAD NOT NULL NUMBER
(20)
ELAPSEDSECONDS NOT NULL FLOAT
(126)
DELETIONDATE CHAR
(16)
REPORT NOT NULL CHAR
(36)
LAUNCHEDBY NOT NULL VARCHAR2
(100)
8 rows selected

Code between sessionFactory.openSession() and session.close():
Code:
using (ISession session = ConnectionAccess.Instance.OpenSession())
            using (ITransaction transaction = session.BeginTransaction())
            {

                if (launchedReport.RecordState == DbStates.fresh)
                {
                    session.Save(launchedReport);
                }
                else
                {
                    session.Update(launchedReport);
                }

                transaction.Commit();
            }


Full stack trace of any exception that occurs:
NHibernate.ADOException occurred
Message="could not insert: [Asterion.Data.DB.LaunchedReportInfo#28a4a844-fc84-4318-a6e3-efeb7e9920c8][SQL: INSERT INTO launchedreports (launched, records, recordsread, elapsedSeconds, deletionDate, report, launchedby, uniqueId) VALUES (?, ?, ?, ?, ?, ?, ?, ?)]"
Source="NHibernate"
StackTrace:
en NHibernate.Persister.Entity.AbstractEntityPersister.Insert(Object id, Object[] fields, Boolean[] notNull, Int32 j, SqlCommandInfo sql, Object obj, ISessionImplementor session) en E:\nHibernate Migration\NHibernate-1.2.1.GA-src\src\NHibernate\Persister\Entity\AbstractEntityPersister.cs:línea 2946
en NHibernate.Persister.Entity.AbstractEntityPersister.Insert(Object id, Object[] fields, Object obj, ISessionImplementor session) en E:\nHibernate Migration\NHibernate-1.2.1.GA-src\src\NHibernate\Persister\Entity\AbstractEntityPersister.cs:línea 2590
en NHibernate.Impl.ScheduledInsertion.Execute() en E:\nHibernate Migration\NHibernate-1.2.1.GA-src\src\NHibernate\Impl\ScheduledInsertion.cs:línea 40
en NHibernate.Impl.SessionImpl.Execute(IExecutable executable) en E:\nHibernate Migration\NHibernate-1.2.1.GA-src\src\NHibernate\Impl\SessionImpl.cs:línea 3280
en NHibernate.Impl.SessionImpl.ExecuteAll(IList list) en E:\nHibernate Migration\NHibernate-1.2.1.GA-src\src\NHibernate\Impl\SessionImpl.cs:línea 3259
en NHibernate.Impl.SessionImpl.Execute() en E:\nHibernate Migration\NHibernate-1.2.1.GA-src\src\NHibernate\Impl\SessionImpl.cs:línea 3223
en NHibernate.Impl.SessionImpl.Flush() en E:\nHibernate Migration\NHibernate-1.2.1.GA-src\src\NHibernate\Impl\SessionImpl.cs:línea 3057
en NHibernate.Transaction.AdoTransaction.Commit() en E:\nHibernate Migration\NHibernate-1.2.1.GA-src\src\NHibernate\Transaction\AdoTransaction.cs:línea 162
en Asterion.Data.DB.LaunchedReportAccess.Insert(IObjectInfo launchedReport) en E:\Asterion\Data\Asterion.Data.DB\Access\LaunchedReportAccess.cs:línea 302
InnerException: System.Data.Odbc.OdbcException
Message=""
Source=""
ErrorCode=-2146232009
StackTrace:
en System.Data.Odbc.OdbcConnection.HandleError(OdbcHandle hrHandle, RetCode retcode)
en System.Data.Odbc.OdbcCommand.ExecuteReaderObject(CommandBehavior behavior, String method, Boolean needReader, Object[] methodArguments, SQL_API odbcApiMethod)
en System.Data.Odbc.OdbcCommand.ExecuteReaderObject(CommandBehavior behavior, String method, Boolean needReader)
en System.Data.Odbc.OdbcCommand.ExecuteNonQuery()
en NHibernate.Impl.BatcherImpl.ExecuteNonQuery(IDbCommand cmd) en E:\nHibernate Migration\NHibernate-1.2.1.GA-src\src\NHibernate\Impl\BatcherImpl.cs:línea 178
en NHibernate.Impl.NonBatchingBatcher.AddToBatch(IExpectation expectation) en E:\nHibernate Migration\NHibernate-1.2.1.GA-src\src\NHibernate\Impl\NonBatchingBatcher.cs:línea 36
en NHibernate.Persister.Entity.AbstractEntityPersister.Insert(Object id, Object[] fields, Boolean[] notNull, Int32 j, SqlCommandInfo sql, Object obj, ISessionImplementor session) en E:\nHibernate Migration\NHibernate-1.2.1.GA-src\src\NHibernate\Persister\Entity\AbstractEntityPersister.cs:línea 2929
InnerException:

Name and version of the database you are using:
Oracle 11.1.0.6.0
ODBC Connector provided by Oracle (version 11.01.00.06)

The generated SQL (show_sql=true):
INSERT INTO launchedreports (launched, records, recordsread, elapsedSeconds, deletionDate, report, launchedby, uniqueId) VALUES (?, ?, ?, ?, ?, ?, ?, ?); p0 = '2009-02-25 16:12:47', p1 = '99', p2 = '99', p3 = '0,1093757', p4 = '', p5 = '0e5df87d-6846-49ae-9618-e3d165f28a1f', p6 = 'rserver', p7 = 'c946d0b9-5a36-4409-aeab-c3fc21ac3d72'

Debug level Hibernate log excerpt:
Code:
<logger name="NHibernate" additivity="false">
      <level value="DEBUG" />
      <appender-ref ref="NHibernate_RollingFile" />
    </logger>


NHibernate Log Details (from session open to error):
DEBUG 9 NHibernate.Impl.SessionImpl - opened session
DEBUG 9 NHibernate.Transaction.AdoTransaction - begin
DEBUG 9 NHibernate.Connection.DriverConnectionProvider - Obtaining IDbConnection from Driver
DEBUG 9 NHibernate.Impl.SessionImpl - generated identifier: c946d0b9-5a36-4409-aeab-c3fc21ac3d72
DEBUG 9 NHibernate.Impl.SessionImpl - saving [Asterion.Data.DB.LaunchedReportInfo#c946d0b9-5a36-4409-aeab-c3fc21ac3d72]
DEBUG 9 NHibernate.Engine.Cascades - unsaved-value strategy NULL
DEBUG 9 NHibernate.Engine.Cascades - unsaved-value strategy NULL
DEBUG 9 NHibernate.Transaction.AdoTransaction - commit
DEBUG 9 NHibernate.Impl.SessionImpl - flushing session
DEBUG 9 NHibernate.Impl.SessionImpl - Flushing entities and processing referenced collections
DEBUG 9 NHibernate.Impl.SessionImpl - Processing unreferenced collections
DEBUG 9 NHibernate.Impl.SessionImpl - scheduling collection removes/(re)creates/updates
DEBUG 9 NHibernate.Impl.SessionImpl - Flushed: 1 insertions, 0 updates, 0 deletions to 1 objects
DEBUG 9 NHibernate.Impl.SessionImpl - Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
DEBUG 9 NHibernate.Impl.Printer - listing entities:
DEBUG 9 NHibernate.Impl.Printer - Asterion.Data.DB.LaunchedReportInfo{Report=ReportInfo#0e5df87d-6846-49ae-9618-e3d165f28a1f, Records=99, Launched=2009-02-25 16:12:47, DeletionDate=null, LaunchedBy=UserInfo#rserver, RecordsRead=99, UniqueId=c946d0b9-5a36-4409-aeab-c3fc21ac3d72, ElapsedSeconds=0,1093757}
DEBUG 9 NHibernate.Impl.SessionImpl - executing flush
DEBUG 9 NHibernate.Impl.ConnectionManager - registering flush begin
DEBUG 9 NHibernate.Persister.Entity.AbstractEntityPersister - Inserting entity: [Asterion.Data.DB.LaunchedReportInfo#c946d0b9-5a36-4409-aeab-c3fc21ac3d72]
DEBUG 9 NHibernate.Impl.BatcherImpl - Opened new IDbCommand, open IDbCommands: 1
DEBUG 9 NHibernate.Impl.BatcherImpl - Building an IDbCommand object for the SqlString: INSERT INTO launchedreports (launched, records, recordsread, elapsedSeconds, deletionDate, report, launchedby, uniqueId) VALUES (?, ?, ?, ?, ?, ?, ?, ?)
DEBUG 9 NHibernate.Persister.Entity.AbstractEntityPersister - Dehydrating entity: [Asterion.Data.DB.LaunchedReportInfo#c946d0b9-5a36-4409-aeab-c3fc21ac3d72]
DEBUG 9 NHibernate.Engine.Cascades - unsaved-value strategy NULL
DEBUG 9 NHibernate.Engine.Cascades - unsaved-value strategy NULL
DEBUG 9 NHibernate.SQL - INSERT INTO launchedreports (launched, records, recordsread, elapsedSeconds, deletionDate, report, launchedby, uniqueId) VALUES (?, ?, ?, ?, ?, ?, ?, ?); p0 = '2009-02-25 16:12:47', p1 = '99', p2 = '99', p3 = '0,1093757', p4 = '', p5 = '0e5df87d-6846-49ae-9618-e3d165f28a1f', p6 = 'rserver', p7 = 'c946d0b9-5a36-4409-aeab-c3fc21ac3d72'
DEBUG 9 NHibernate.Impl.BatcherImpl - Closed IDbCommand, open IDbCommands: 0
DEBUG 9 NHibernate.Util.ADOExceptionReporter - could not insert: [Asterion.Data.DB.LaunchedReportInfo#c946d0b9-5a36-4409-aeab-c3fc21ac3d72] [INSERT INTO launchedreports (launched, records, recordsread, elapsedSeconds, deletionDate, report, launchedby, uniqueId) VALUES (?, ?, ?, ?, ?, ?, ?, ?)]
System.Data.Odbc.OdbcException


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.