-->
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.  [ 5 posts ] 
Author Message
 Post subject: Error when using Firebird and RC1
PostPosted: Thu Sep 22, 2005 5:08 pm 
Beginner
Beginner

Joined: Sat Apr 17, 2004 1:11 am
Posts: 36
I get an exception when trying to get a collection lazily - invalid SQL. The mapping file is below the log4net text as well...

Quote:
2250 [1696] DEBUG NHibernate.Impl.SessionImpl (null) - initializing collection [TestBOM.Employee._Offices#32769]
2250 [1696] DEBUG NHibernate.Impl.SessionImpl (null) - checking second-level cache
2250 [1696] DEBUG NHibernate.Impl.SessionImpl (null) - collection not cached
2265 [1696] DEBUG NHibernate.Impl.BatcherImpl (null) - Opened new IDbCommand, open IDbCommands :1
2265 [1696] DEBUG NHibernate.Impl.BatcherImpl (null) - Building an IDbCommand object for the SqlString: SELECT _offices0_.employee_id as employee1___, _offices0_.office_id as office_id__, office1_.Id as Id
0_, office1_.BuildingNumber as Building2_0_ FROM employee_office _offices0_ inner join offices office1_ on _offices0_.office_id=office1_.Id WHERE _offices0_.employee_id=:employee_id
2265 [1696] DEBUG NHibernate.Type.NullableType (null) - binding '32769' to parameter: 0
2281 [1696] INFO NHibernate.Loader.Loader (null) - SELECT _offices0_.employee_id as employee1___, _offices0_.office_id as office_id__, office1_.Id as Id0_, office1_.BuildingNumber as Building2_0_ FROM empl
oyee_office _offices0_ inner join offices office1_ on _offices0_.office_id=office1_.Id WHERE _offices0_.employee_id=@p0
2281 [1696] DEBUG NHibernate.SQL (null) - SELECT _offices0_.employee_id as employee1___, _offices0_.office_id as office_id__, office1_.Id as Id0_, office1_.BuildingNumber as Building2_0_ FROM employee_offi
ce _offices0_ inner join offices office1_ on _offices0_.office_id=office1_.Id WHERE _offices0_.employee_id=@p0
2390 [1696] DEBUG NHibernate.Util.ADOExceptionReporter (null) - SQL Exception
FirebirdSql.Data.Firebird.FbException: Dynamic SQL Error
SQL error code = -104
Token unknown - line 1, char 18

.
at FirebirdSql.Data.Firebird.FbCommand.ExecuteReader(CommandBehavior behavior)
at FirebirdSql.Data.Firebird.FbCommand.System.Data.IDbCommand.ExecuteReader()
at NHibernate.Impl.BatcherImpl.ExecuteReader(IDbCommand cmd)
at NHibernate.Loader.Loader.GetResultSet(IDbCommand st, RowSelection selection, ISessionImplementor session)
2421 [1696] WARN NHibernate.Util.ADOExceptionReporter (null) - FirebirdSql.Data.Firebird.FbException: Dynamic SQL Error
SQL error code = -104
Token unknown - line 1, char 18
.
at FirebirdSql.Data.Firebird.FbCommand.ExecuteReader(CommandBehavior behavior)
at FirebirdSql.Data.Firebird.FbCommand.System.Data.IDbCommand.ExecuteReader()
at NHibernate.Impl.BatcherImpl.ExecuteReader(IDbCommand cmd)
at NHibernate.Loader.Loader.GetResultSet(IDbCommand st, RowSelection selection, ISessionImplementor session)
2437 [1696] ERROR NHibernate.Util.ADOExceptionReporter (null) - Dynamic SQL Error
SQL error code = -104
Token unknown - line 1, char 18
.
2453 [1696] DEBUG NHibernate.Impl.BatcherImpl (null) - Closed IDbCommand, open IDbCommands :0
2453 [1696] ERROR NHibernate.ADOException (null) - could not initialize collection: [TestBOM.Employee._Offices#32769]
FirebirdSql.Data.Firebird.FbException: Dynamic SQL Error
SQL error code = -104
Token unknown - line 1, char 18
.
at FirebirdSql.Data.Firebird.FbCommand.ExecuteReader(CommandBehavior behavior)
at FirebirdSql.Data.Firebird.FbCommand.System.Data.IDbCommand.ExecuteReader()
at NHibernate.Impl.BatcherImpl.ExecuteReader(IDbCommand cmd)
at NHibernate.Loader.Loader.GetResultSet(IDbCommand st, RowSelection selection, ISessionImplementor session)
at NHibernate.Loader.Loader.DoQuery(ISessionImplementor session, QueryParameters queryParameters, Object optionalObject, Object optionalId, Object[] optionalCollectionKeys, Boolean returnProxies)
at NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor session, QueryParameters queryParameters, Object optionalObject, Object optionalId, Object[] optionalCollectionKeys
, Boolean returnProxies)
at NHibernate.Loader.CollectionLoader.Initialize(Object id, ISessionImplementor session)
at NHibernate.Collection.AbstractCollectionPersister.Initialize(Object key, ISessionImplementor session)


Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">

   <class name="TestBOM.Employer,TestBOM" table="employers">
      <jcs-cache usage="read-write"/>
      <id name="Id">
         <generator class="NHibernate.Id.TableHiLoGenerator">
            <param name="table">LASTEMPLOYERS</param>
            <param name="column">LASTID</param>
         </generator>
      </id>
      <property name="Name"/>
   </class>

   <class name="TestBOM.Employment,TestBOM" table="employment_periods">
      <jcs-cache usage="read-write"/>
      <id name="Id">
         <generator class="NHibernate.Id.TableHiLoGenerator">
            <param name="table">LASTEMPLOYMENT_PERIODS</param>
            <param name="column">LASTID</param>
         </generator>
      </id>
      <property name="StartDate" column="start_date"/>
      <property name="EndDate" column="end_date"/>

      <component name="HourlyRate" class="TestBOM.MonetoryAmount,TestBOM">
         <property name="Amount">
            <column name="hourly_rate" sql-type="NUMERIC(12, 2)"/>
         </property>
         <property name="Currency" length="12"/>
      </component>

      <many-to-one name="LEmployer" column="employer_id" not-null="true"/>
      <many-to-one name="LEmployee" column="employee_id" not-null="true"/>

   </class>

   <class name="TestBOM.Employee,TestBOM" table="employees">
      <!--jcs-cache usage="read-write"/-->
      <id name="Id">
         <generator class="NHibernate.Id.TableHiLoGenerator">
            <param name="table">lastemployees</param>
            <param name="column">LASTID</param>
         </generator>
      </id>
      <property name="TaxFileNumber"/>
      <component name="LName" class="TestBOM.Name,TestBOM">
         <property name="FirstName"/>
         <property name="Initial"/>
         <property name="LastName"/>
      </component>
      <bag name="_Offices" table="employee_office" access="field" lazy="true">
         <key>
            <column name="employee_id" not-null="true"/>
         </key>
         <many-to-many class="TestBOM.Office,TestBOM">
            <column name="office_id" not-null="true"/>
         </many-to-many>
      </bag>
   </class>

   <class name="TestBOM.Office,TestBOM" table="offices">
      <jcs-cache usage="read-write"/>
      <id name="Id">
         <generator class="NHibernate.Id.TableHiLoGenerator">
            <param name="table">lastoffices</param>
            <param name="column">LASTID</param>
         </generator>
      </id>
      <property name="BuildingNumber"/>
      <bag name="_Employees" table="employee_office" access="field" lazy="true">
         <key column="office_id"/>
         <many-to-many class="TestBOM.Employee,TestBOM" column="employee_id"/>
      </bag>
   </class>


   <query name="TestBOM.Office.OfficeByBuildingNumber">
      <![CDATA[
    from TestBOM.Office as Office
    where Office.BuildingNumber = ?]]>
   </query>

</hibernate-mapping>


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 22, 2005 6:41 pm 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
What version of NHibernate are you using? I don't know much about Firebird, from the error it looks like Firebird can't handle underscores in table aliases, and there's a workaround for this in 0.9.1.

Update: err, sorry, now I see that RC1 in the title. I'll need to take a closer look at it.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 23, 2005 7:31 am 
Beginner
Beginner

Joined: Sat Apr 17, 2004 1:11 am
Posts: 36
Cool - thx. I can't move to RC1 in our environment without Firebird working. I was hoping to test the performance of RC1 but I'll get it in the next release I'm sure.

Thx for the response...

benster


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 25, 2005 6:34 pm 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
This should be fixed in the upcoming rc2 release.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 26, 2005 9:15 am 
Beginner
Beginner

Joined: Sat Apr 17, 2004 1:11 am
Posts: 36
Awesome - thx a bunch...

benster


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

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.