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: Problem/Bug with JetDriver dielect on joined subclass
PostPosted: Fri Sep 21, 2007 3:03 pm 
Beginner
Beginner

Joined: Tue Sep 14, 2004 1:03 pm
Posts: 33
Location: Calgary, Alberta Canada
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'


Last edited by padlewski on Mon Sep 24, 2007 2:31 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 21, 2007 9:29 pm 
Hibernate Team
Hibernate Team

Joined: Tue Jun 13, 2006 11:29 pm
Posts: 315
Location: Calgary, Alberta, Canada
There are known problems with the JetDriver:
http://www.hibernate.org/361.html?cmd=c ... de=2713#A3

_________________
Karl Chu


Top
 Profile  
 
 Post subject: A lot more problems
PostPosted: Mon Sep 24, 2007 12:44 pm 
Beginner
Beginner

Joined: Tue Sep 14, 2004 1:03 pm
Posts: 33
Location: Calgary, Alberta Canada
OK....

Anyway,

I've changed my subclass strategy to table to hierarchy, and now I have a new problem with nhibernate not recognizing the discriminator. I did confirm the data in the table, and the discriminator value is 'POINT' so it should not want to create it as a 'FUGITIVE'.

Code:
Spring.Data.NHibernate.HibernateObjectRetrievalFailureException: Object with id: 114 was not of the specified sublcass: AMEC.EE.FAP.BusinessObjects.FugitiveSource (loading object was of wrong class [AMEC.EE.FAP.BusinessObjects.PointSource]) ---> NHibernate.WrongClassException: Object with id: 114 was not of the specified sublcass: AMEC.EE.FAP.BusinessObjects.FugitiveSource (loading object was of wrong class [AMEC.EE.FAP.BusinessObjects.PointSource])
   at NHibernate.Loader.Loader.InstanceAlreadyLoaded(IDataReader rs, Int32 i, ILoadable persister, EntityKey key, Object obj, LockMode lockMode, ISessionImplementor session)
   at NHibernate.Loader.Loader.GetRow(IDataReader rs, ILoadable[] persisters, EntityKey[] keys, Object optionalObject, EntityKey optionalObjectKey, LockMode[] lockModes, IList hydratedObjects, ISessionImplementor session)
   at NHibernate.Loader.Loader.GetRowFromResultSet(IDataReader resultSet, ISessionImplementor session, QueryParameters queryParameters, LockMode[] lockModeArray, EntityKey optionalObjectKey, IList hydratedObjects, EntityKey[] keys, Boolean returnProxies)
   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)
   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)
   --- End of inner exception stack trace ---
   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_d77d1e26813849f3b385184c5127c723.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


Code:
The Mapping is now:
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
  <class name="AMEC.EE.FAP.BusinessObjects.Source, AMEC.EE.FAP.BusinessObjects"
         table="POINT_SOURCES">
    <id name="ID"
        column="SOURCE_ID"
        type="Int64"
        unsaved-value="0">
      <generator class="identity" />
    </id>
    <discriminator column="SOURCE_TYPE"
                   not-null="true"
                   type="String"
                   length="50"/>
    <many-to-one name="Facility"
                 class="AMEC.EE.FAP.BusinessObjects.Facility, AMEC.EE.FAP.BusinessObjects"
                 column="FACILITY_ID"
                 not-null="true"
                 unique="false"
                 lazy="false"
                 cascade="none" />
    <property name="Name"
              column="NAME"
              type="String"
              length="100"
              not-null="true"
              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="Details"
         table="POINT_SOURCE_DETAILS"
         cascade="save-update"
         inverse="true"
         lazy="false">
      <key column="SOURCE_ID"/>
      <one-to-many class="AMEC.EE.FAP.BusinessObjects.SourceDetail, 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>
    <subclass name="AMEC.EE.FAP.BusinessObjects.PointSource, AMEC.EE.FAP.BusinessObjects"
              extends="AMEC.EE.FAP.BusinessObjects.Source, AMEC.EE.FAP.BusinessObjects"
              discriminator-value="POINT">
      <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"/>
      <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"/>
      <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>
    </subclass>
    <subclass name="AMEC.EE.FAP.BusinessObjects.FugitiveSource, AMEC.EE.FAP.BusinessObjects"
              extends="AMEC.EE.FAP.BusinessObjects.Source, AMEC.EE.FAP.BusinessObjects"
              discriminator-value="FUGITIVE">
      <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"/>
    </subclass>
  </class>


Last edited by padlewski on Mon Sep 24, 2007 2:30 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 24, 2007 2:04 pm 
Hibernate Team
Hibernate Team

Joined: Tue Jun 13, 2006 11:29 pm
Posts: 315
Location: Calgary, Alberta, Canada
I see that the FugitiveSource is not a subclass of PointSource anymore as in your first post. Other than that, nothing obvious is jumping out at me. Please post code between OpenSession() and session.Close(), and probably table schema if you would like further help.

By the way, please enclose code with the [code] markup. It is next to impossible to read a long block of code or mapping when it is not formatted. Thanks.

_________________
Karl Chu


Top
 Profile  
 
 Post subject: I managed to get it working
PostPosted: Mon Sep 24, 2007 2:27 pm 
Beginner
Beginner

Joined: Tue Sep 14, 2004 1:03 pm
Posts: 33
Location: Calgary, Alberta Canada
I managed to get it working,

In the classes where I used the various types in collections, I had to specify the where attribute so that it would get the appropriate subtype.
Specifying the object type (in the one-to-many tag) for the collection did not seem to be enough (although I thought I've used this method in SQL Server before). Possibly the collection-type attribute would work as well.

The code in between the session was the same as before. The reason I Fugitive extends Source, is that I figured if I was going to make the change to the schema, I may as well do it to the business classes to better model the domain.

Now, I'm not sure if the mapping change I had made here would have fixed the original problem. I'm also not sure if this whole thing is really related to the JetDriver.

Code:
<class name="AMEC.EE.FAP.BusinessObjects.Facility, AMEC.EE.FAP.BusinessObjects"
         table="FACILITIES">
    <id name="ID"
        column="FACILITY_ID"
        type="System.Int64"
        unsaved-value="0">
      <generator class="identity" />
    </id>
    <many-to-one name="Operator"
                 class="AMEC.EE.FAP.BusinessObjects.Operator, AMEC.EE.FAP.BusinessObjects"
                 column="OPERATOR_ID"
                 lazy="false" />
    <property name="Name"
              column="NAME"
              type="System.String"
              length="100"
              not-null="true"
              unique="false" />
<--SNIP Not important -->
    <bag name="PointSources"
         lazy="true"
         cascade="none"
         inverse="true"
         generic="true"
         where="SOURCE_TYPE = 'POINT'">
      <key column="FACILITY_ID"/>
      <one-to-many class="AMEC.EE.FAP.BusinessObjects.PointSource, AMEC.EE.FAP.BusinessObjects"/>
    </bag>
    <bag name="FugitiveSources"
         lazy="true"
         cascade="none"
         inverse="true"
         generic="true"
         where="SOURCE_TYPE = 'FUGITIVE'">
      <key column="FACILITY_ID"/>
      <one-to-many class="AMEC.EE.FAP.BusinessObjects.FugitiveSource, AMEC.EE.FAP.BusinessObjects"/>
    </bag>
  </class>


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.