I'm having trouble with the JetDriver. It seems to be making an error on the query it creates for Getting a paticular object. I have a collection of some types (FugitiveSource) that extends a PointSource. But as can be seen from the query, That it is putting the FacilityID as being in the Fugitive_Sources table when it is in the Point_Sources table.
I can save new Fugitive sources, so that query is being build just fine, but I can't get the ones I've persisted. I also have no problems in getting my PointSource objects. I've played around with the Join attribute and the not-null attribute with no success.
I think this might be a bug in the jet driver implementation but I'm not sure.
Thanks,
Darin
Hibernate version: 1.2.0.4000
Hibernate Jet Driver version: 1.2.0.4000
Mapping documents:
Code:
<class name="AMEC.EE.FAP.BusinessObjects.PointSource, AMEC.EE.FAP.BusinessObjects"
table="POINT_SOURCES">
<id name="ID"
column="SOURCE_ID"
type="Int64"
unsaved-value="0">
<generator class="identity" />
</id>
<many-to-one name="Location"
class="AMEC.EE.FAP.BusinessObjects.Location, AMEC.EE.FAP.BusinessObjects"
column="LOCATION_ID"
not-null="false"
unique="false"
lazy="false"
cascade="save-update"/>
[b] <many-to-one name="Facility"
class="AMEC.EE.FAP.BusinessObjects.Facility, AMEC.EE.FAP.BusinessObjects"
column="FACILITY_ID"
not-null="false"
fetch="join"
unique="false"
lazy="false"
cascade="none" />[/b]
<property name="Name"
column="NAME"
type="String"
length="100"
not-null="true"
unique="false"/>
<property name="Height"
column="HEIGHT"
type="Decimal"
not-null="false"
unique="false"/>
<property name="Diameter"
column="DIAMETER"
type="Decimal"
not-null="false"
unique="false"/>
<property name="ExitVelocity"
column="EXIT_VELOCITY"
type="Decimal"
not-null="false"
unique="false"/>
<property name="ExitTemp"
column="EXIT_TEMP"
type="Decimal"
not-null="false"
unique="false"/>
<property name="OperatorCode"
column="OPERATOR_CODE"
type="String"
length="50"
not-null="false"
unique="false"/>
<property name="Comments"
column="COMMENTS"
type="String"
not-null="false"
unique="false"/>
<property name="IsExisting"
column="IS_EXISTING"
type="Boolean"
not-null="false"
unique="false"/>
<property name="IsApproved"
column="IS_APPROVED"
type="Boolean"
not-null="false"
unique="false"/>
<bag name="HistoricalLocations"
table="SOURCE_HISTORICAL_LOCATIONS"
cascade="save-update"
inverse="true"
lazy="false">
<key column="LOCATION_ID"/>
<one-to-many class="AMEC.EE.FAP.BusinessObjects.SourceHistoricalLocation, AMEC.EE.FAP.BusinessObjects"/>
</bag>
<bag name="Details"
table="POINT_SOURCE_DETAILS"
cascade="save-update"
inverse="true"
lazy="false">
<key column="SOURCE_ID"/>
<one-to-many class="AMEC.EE.FAP.BusinessObjects.PointSourceDetail, AMEC.EE.FAP.BusinessObjects"/>
</bag>
<bag name="Emissions"
table="EMISSIONS"
cascade="none"
inverse="true"
lazy="false">
<key column="SOURCE_ID"/>
<one-to-many class="AMEC.EE.FAP.BusinessObjects.Emission, AMEC.EE.FAP.BusinessObjects"/>
</bag>
<bag name="ApprovalLimits"
table="APPROVAL_LIMITS"
cascade="none"
inverse="true"
lazy="false">
<key column="SOURCE_ID"/>
<one-to-many class="AMEC.EE.FAP.BusinessObjects.ApprovalLimit, AMEC.EE.FAP.BusinessObjects"/>
</bag>
</class>
<joined-subclass name="AMEC.EE.FAP.BusinessObjects.FugitiveSource, AMEC.EE.FAP.BusinessObjects"
extends="AMEC.EE.FAP.BusinessObjects.PointSource, AMEC.EE.FAP.BusinessObjects"
table="FUGITIVE_SOURCES">
<key column="SOURCE_ID"/>
<many-to-one name="NeLocation"
class="AMEC.EE.FAP.BusinessObjects.Location, AMEC.EE.FAP.BusinessObjects"
column="NE_LOCATION"
not-null="false"
unique="false"
lazy="false"
cascade="save-update" />
<many-to-one name="SwLocation"
class="AMEC.EE.FAP.BusinessObjects.Location, AMEC.EE.FAP.BusinessObjects"
column="SW_LOCATION"
not-null="false"
unique="false"
lazy="false"
cascade="save-update" />
<property name="Area"
column="AREA"
type="Decimal"
not-null="false"
unique="false" />
<property name="BaseMasl"
column="BASE_MASL"
type="Decimal"
not-null="false"
unique="false"/>
<property name="BiggestShm"
column="BIGGEST_SHM"
type="Decimal"
not-null="false"
unique="false"/>
</joined-subclass>
Code between sessionFactory.openSession() and session.close():Code:
Session.Refresh(obj);
if(!NHibernateUtil.IsInitialized(obj.FugitiveSources))
NHibernateUtil.Initalize(obj.FugitiveSources)
Full stack trace of any exception that occurs:Code:
NHibernate: SELECT [b]fugitiveso0_.FACILITY_ID as FACILITY7___1_,[/b] fugitiveso0_.SOURCE_ID as SOURCE1_1_, fugitiveso0_.SOURCE_ID as SOURCE1_6_0_, fugitiveso0_.NE_LOCATION as NE2_7_0_, fugitiveso0_.SW_LOCATION as SW3_7_0_, fugitiveso0_.AREA as AREA7_0_, fugitiveso0_.BASE_MASL as BASE5_7_0_, fugitiveso0_.BIGGEST_SHM as BIGGEST6_7_0_, fugitiveso0_1_.LOCATION_ID as LOCATION2_6_0_, fugitiveso0_1_.FACILITY_ID as FACILITY3_6_0_, fugitiveso0_1_.NAME as NAME6_0_, fugitiveso0_1_.HEIGHT as HEIGHT6_0_, fugitiveso0_1_.DIAMETER as DIAMETER6_0_, fugitiveso0_1_.EXIT_VELOCITY as EXIT7_6_0_, fugitiveso0_1_.EXIT_TEMP as EXIT8_6_0_, fugitiveso0_1_.OPERATOR_CODE as OPERATOR9_6_0_, fugitiveso0_1_.COMMENTS as COMMENTS6_0_, fugitiveso0_1_.IS_EXISTING as IS11_6_0_, fugitiveso0_1_.IS_APPROVED as IS12_6_0_ FROM [b] FUGITIVE_SOURCES fugitiveso0_ [/b] inner join POINT_SOURCES fugitiveso0_1_ on fugitiveso0_.SOURCE_ID=fugitiveso0_1_.SOURCE_ID WHERE fugitiveso0_.FACILITY_ID=?; @p0 = '113'
[b]ERROR - No value given for one or more required parameters.[/b]
ERROR - No value given for one or more required parameters.
ERROR - Error Removing Facility
NHibernate.ADOException: could not initialize a collection: [AMEC.EE.FAP.BusinessObjects.Facility.FugitiveSources#113][SQL: SELECT fugitiveso0_.FACILITY_ID as FACILITY7___1_, fugitiveso0_.SOURCE_ID as SOURCE1_1_, fugitiveso0_.SOURCE_ID as SOURCE1_6_0_, fugitiveso0_.NE_LOCATION as NE2_7_0_, fugitiveso0_.SW_LOCATION as SW3_7_0_, fugitiveso0_.AREA as AREA7_0_, fugitiveso0_.BASE_MASL as BASE5_7_0_, fugitiveso0_.BIGGEST_SHM as BIGGEST6_7_0_, fugitiveso0_1_.LOCATION_ID as LOCATION2_6_0_, fugitiveso0_1_.FACILITY_ID as FACILITY3_6_0_, fugitiveso0_1_.NAME as NAME6_0_, fugitiveso0_1_.HEIGHT as HEIGHT6_0_, fugitiveso0_1_.DIAMETER as DIAMETER6_0_, fugitiveso0_1_.EXIT_VELOCITY as EXIT7_6_0_, fugitiveso0_1_.EXIT_TEMP as EXIT8_6_0_, fugitiveso0_1_.OPERATOR_CODE as OPERATOR9_6_0_, fugitiveso0_1_.COMMENTS as COMMENTS6_0_, fugitiveso0_1_.IS_EXISTING as IS11_6_0_, fugitiveso0_1_.IS_APPROVED as IS12_6_0_ FROM FUGITIVE_SOURCES fugitiveso0_ inner join POINT_SOURCES fugitiveso0_1_ on fugitiveso0_.SOURCE_ID=fugitiveso0_1_.SOURCE_ID WHERE fugitiveso0_.FACILITY_ID=?] ---> System.Data.OleDb.OleDbException: No value given for one or more required parameters.
at System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method)
at System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.OleDb.OleDbCommand.ExecuteReader()
at NHibernate.JetDriver.JetDbCommand.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, Boolean returnProxies)
at NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies)
at NHibernate.Loader.Loader.LoadCollection(ISessionImplementor session, Object id, IType type)
--- End of inner exception stack trace ---
at NHibernate.Loader.Loader.LoadCollection(ISessionImplementor session, Object id, IType type)
at NHibernate.Loader.Collection.CollectionLoader.Initialize(Object id, ISessionImplementor session)
at NHibernate.Persister.Collection.AbstractCollectionPersister.Initialize(Object key, ISessionImplementor session)
at NHibernate.Impl.SessionImpl.InitializeCollection(IPersistentCollection collection, Boolean writing)
at NHibernate.Collection.AbstractPersistentCollection.ForceInitialization()
at NHibernate.NHibernateUtil.Initialize(Object proxy)
at AMEC.EE.FAP.Persistence.Impl.FacilityDao.<>c__DisplayClassa.<Initialize>b__9(ISession session) in C:\VS_Development\Projects\FAP\Domain\src\FAP.Persistence\Impl\FacilityDao.cs:line 101
at Spring.Data.NHibernate.Generic.ExecuteHibernateCallbackUsingDelegate`1.DoInHibernate(ISession session)
at Spring.Data.NHibernate.Generic.HibernateTemplate.Execute[T](IHibernateCallback`1 action, Boolean exposeNativeSession)
at Spring.Data.NHibernate.Generic.HibernateTemplate.Execute[T](IHibernateCallback`1 action)
at Spring.Data.NHibernate.Generic.HibernateTemplate.Execute[T](HibernateDelegate`1 del)
at AMEC.EE.FAP.Persistence.Impl.FacilityDao.Initialize(Facility obj) in C:\VS_Development\Projects\FAP\Domain\src\FAP.Persistence\Impl\FacilityDao.cs:line 93
at CompositionAopProxy_0523a8f532a34d609f0a28704f5f50b4.Initialize(Facility obj)
at AMEC.EE.FAP.Domain.Services.Impl.FacilityServiceImpl._RemoveFacility(Facility facility) in C:\VS_Development\Projects\FAP\Domain\src\FAP.Domain\Services\Impl\FacilityServiceImpl.cs:line 105
at AMEC.EE.FAP.Domain.Services.Impl.FacilityServiceImpl.RemoveFacility(Facility facility) in C:\VS_Development\Projects\FAP\Domain\src\FAP.Domain\Services\Impl\FacilityServiceImpl.cs:line 85
Name and version of the database you are using:MS Access2002
The generated SQL (show_sql=true):Code:
NHibernate: SELECT fugitiveso0_.FACILITY_ID as FACILITY7___1_, fugitiveso0_.SOURCE_ID as SOURCE1_1_, fugitiveso0_.SOURCE_ID as SOURCE1_6_0_, fugitiveso0_.NE_LOCATION as NE2_7_0_, fugitiveso0_.SW_LOCATION as SW3_7_0_, fugitiveso0_.AREA as AREA7_0_, fugitiveso0_.BASE_MASL as BASE5_7_0_, fugitiveso0_.BIGGEST_SHM as BIGGEST6_7_0_, fugitiveso0_1_.LOCATION_ID as LOCATION2_6_0_, fugitiveso0_1_.FACILITY_ID as FACILITY3_6_0_, fugitiveso0_1_.NAME as NAME6_0_, fugitiveso0_1_.HEIGHT as HEIGHT6_0_, fugitiveso0_1_.DIAMETER as DIAMETER6_0_, fugitiveso0_1_.EXIT_VELOCITY as EXIT7_6_0_, fugitiveso0_1_.EXIT_TEMP as EXIT8_6_0_, fugitiveso0_1_.OPERATOR_CODE as OPERATOR9_6_0_, fugitiveso0_1_.COMMENTS as COMMENTS6_0_, fugitiveso0_1_.IS_EXISTING as IS11_6_0_, fugitiveso0_1_.IS_APPROVED as IS12_6_0_ FROM FUGITIVE_SOURCES fugitiveso0_ inner join POINT_SOURCES fugitiveso0_1_ on fugitiveso0_.SOURCE_ID=fugitiveso0_1_.SOURCE_ID WHERE fugitiveso0_.FACILITY_ID=?; @p0 = '113'