Hello ,
I'm trying to establish HasManyToMany between 2 tables in my legacy
Oracle db:


  HasManyToMany<YechidaGroup>(x => x.Col_yig)
                    .ChildKeyColumn("YIG_GROUP_RECID")
                    .ParentKeyColumn("PIG_GROUP_RECID")
                    .Fetch.Select() ;

It creates an alias for the association join by name
"YechidaGroupToProductsGroup" and in the output  of my test , when I
am trying to reach the children's collection I'm getting
 ---> System.Data.OracleClient.OracleException: ORA-00942: table or
view does not exist


full output stack :
------ Test started: Assembly: Ness.DoarKamuti.DataLayer.Tests.dll
------

TestCase
'M:Ness.DoarKamuti.DataLayer.Tests.ProductsGroupMappingTests.TestProductsGroupMapping'
failed: could not initialize a collection:
[Ness.DoarKamuti.Infrastructure.Entities.ProductsGroup.Col_yig#403]
[SQL: SELECT col_yig0_."PIG_GROUP_RECID" as PIG1_2_,
col_yig0_."YIG_GROUP_RECID" as YIG2_2_, yechidagro1_."YIG_RECID" as
YIG1_29_0_, yechidagro1_."YIG_FROM_TOKEF" as YIG2_29_0_,
yechidagro1_."YIG_UNTIL_TOKEF" as YIG3_29_0_,
yechidagro1_."YIG_YECHIDAID" as YIG4_29_0_,
yechidagro1_."YIG_GROUP_RECID" as YIG5_29_0_,
yechidatdo2_."YDR_YECHIDAT_DOARID" as YDR1_14_1_,
yechidatdo2_."YDR_DELIVERYNUM" as YDR2_14_1_ FROM
YechidaGroupToProductsGroup col_yig0_ left outer join
T_YECHIDOT_DOAR_IN_GROUP yechidagro1_ on
col_yig0_."YIG_GROUP_RECID"=yechidagro1_."YIG_RECID" left outer join
YECHIDAT_DOAR yechidatdo2_ on
yechidagro1_."YIG_YECHIDAID"=yechidatdo2_."YDR_YECHIDAT_DOARID" WHERE
col_yig0_."PIG_GROUP_RECID"=?]
        NHibernate.Exceptions.GenericADOException: could not initialize a
collection:
[Ness.DoarKamuti.Infrastructure.Entities.ProductsGroup.Col_yig#403]
[SQL: SELECT col_yig0_."PIG_GROUP_RECID" as PIG1_2_,
col_yig0_."YIG_GROUP_RECID" as YIG2_2_, yechidagro1_."YIG_RECID" as
YIG1_29_0_, yechidagro1_."YIG_FROM_TOKEF" as YIG2_29_0_,
yechidagro1_."YIG_UNTIL_TOKEF" as YIG3_29_0_,
yechidagro1_."YIG_YECHIDAID" as YIG4_29_0_,
yechidagro1_."YIG_GROUP_RECID" as YIG5_29_0_,
yechidatdo2_."YDR_YECHIDAT_DOARID" as YDR1_14_1_,
yechidatdo2_."YDR_DELIVERYNUM" as YDR2_14_1_ FROM
YechidaGroupToProductsGroup col_yig0_ left outer join
T_YECHIDOT_DOAR_IN_GROUP yechidagro1_ on
col_yig0_."YIG_GROUP_RECID"=yechidagro1_."YIG_RECID" left outer join
YECHIDAT_DOAR yechidatdo2_ on
yechidagro1_."YIG_YECHIDAID"=yechidatdo2_."YDR_YECHIDAT_DOARID" WHERE
col_yig0_."PIG_GROUP_RECID"=?] --->
System.Data.OracleClient.OracleException: ORA-00942: table or view
does not exist

        at System.Data.OracleClient.OracleConnection.CheckError
(OciErrorHandle errorHandle, Int32 rc)
        at System.Data.OracleClient.OracleCommand.Execute(OciStatementHandle
statementHandle, CommandBehavior behavior, Boolean needRowid,
OciRowidDescriptor& rowidDescriptor, ArrayList&
resultParameterOrdinals)
        at System.Data.OracleClient.OracleCommand.Execute(OciStatementHandle
statementHandle, CommandBehavior behavior, ArrayList&
resultParameterOrdinals)
        at System.Data.OracleClient.OracleCommand.ExecuteReader
(CommandBehavior behavior)
        at System.Data.OracleClient.OracleCommand.ExecuteDbDataReader
(CommandBehavior behavior)
        at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader
()
        at NHibernate.AdoNet.AbstractBatcher.ExecuteReader(IDbCommand cmd)
        at NHibernate.Loader.Loader.GetResultSet(IDbCommand st, Boolean
autoDiscoverTypes, Boolean callable, 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.Event.Default.DefaultInitializeCollectionEventListener.OnInitializeCollection
(InitializeCollectionEvent event)
        at NHibernate.Impl.SessionImpl.InitializeCollection
(IPersistentCollection collection, Boolean writing)
        at NHibernate.Collection.AbstractPersistentCollection.Initialize
(Boolean writing)
        at NHibernate.Collection.AbstractPersistentCollection.Read()
        at NHibernate.Collection.AbstractPersistentCollection.ReadSize()
        at NHibernate.Collection.PersistentBag.get_Count()
        C:\NetProjects\NESS\Ness.DoarKamuti\Ness.DoarKamuti.DataLayer.Tests
\MappingTests\ProductsGroupMappingTests.cs(29,0): at
Ness.DoarKamuti.DataLayer.Tests.ProductsGroupMappingTests.TestProductsGroupMapping
()

2010-01-24 15:12:00,951 [TestRunnerThread] DEBUG NHibernate.SQL -
SELECT productsgr0_."PIG_RECID" as PIG1_30_0_,
productsgr0_."PIG_FROM_TOKEF" as PIG2_30_0_,
productsgr0_."PIG_GROUP_RECID" as PIG3_30_0_,
productsgr0_."PIG_PRODUCTID" as PIG4_30_0_,
productsgr0_."PIG_UNTIL_TOKEF" as PIG5_30_0_ FROM T_PRODUCTS_IN_GROUP
productsgr0_ WHERE productsgr0_."PIG_RECID"=:p0;:p0 = 403
2010-01-24 15:12:01,091 [TestRunnerThread] DEBUG NHibernate.SQL -
SELECT col_yig0_."PIG_GROUP_RECID" as PIG1_2_,
col_yig0_."YIG_GROUP_RECID" as YIG2_2_, yechidagro1_."YIG_RECID" as
YIG1_29_0_, yechidagro1_."YIG_FROM_TOKEF" as YIG2_29_0_,
yechidagro1_."YIG_UNTIL_TOKEF" as YIG3_29_0_,
yechidagro1_."YIG_YECHIDAID" as YIG4_29_0_,
yechidagro1_."YIG_GROUP_RECID" as YIG5_29_0_,
yechidatdo2_."YDR_YECHIDAT_DOARID" as YDR1_14_1_,
yechidatdo2_."YDR_DELIVERYNUM" as YDR2_14_1_ FROM
YechidaGroupToProductsGroup col_yig0_ left outer join
T_YECHIDOT_DOAR_IN_GROUP yechidagro1_ on
col_yig0_."YIG_GROUP_RECID"=yechidagro1_."YIG_RECID" left outer join
YECHIDAT_DOAR yechidatdo2_ on
yechidagro1_."YIG_YECHIDAID"=yechidatdo2_."YDR_YECHIDAT_DOARID" WHERE
col_yig0_."PIG_GROUP_RECID"=:p0;:p0 = 403

0 passed, 1 failed, 0 skipped, took 12.53 seconds (Ad hoc).

-------------------------------------------------------------------------------------------------
The question is , how can I map my 2 tables as Many to Many not
through Id comparison and still get the result of join ?

p.s.
There is an issue with #164 build of Fluent Nhibernate , making as to
map
like this
 Map(x => x.Pig_group_recid).Column("PIG_GROUP_RECID");
instead of
 Map(x => x.Pig_group_recid);
Otherwise FNH doesn't recognize the columns , even though they were
mapped properly .

-- 
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/fluent-nhibernate?hl=en.

Reply via email to