-->
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: Unmappable table
PostPosted: Tue Jun 16, 2009 7:50 am 
Newbie

Joined: Fri Apr 03, 2009 10:36 am
Posts: 6
I'm gradually working my way through mapping a legacy database to NHibernate. After mapping >40 tables I think I've found one that's unmappable - unless someone here can help?

1) It doesn't have a PK defined
2) The natural PK would be a composite PK made up of all 5 columns
3) 4 of the columns are nullable

Because the candidate composite PK columns are nullable, I believe this is impossible to map in NHibernate - am I correct?


When I map the entity and attempt to query it, I've been getting errors like:

[1764] Index was out of range. Must be non-negative and less than the size of the collection.
[1764] Parameter name: index
[1764] System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
[1764] Parameter name: index
[1764] at System.Collections.ArrayList.get_Item(Int32 index)
[1764] at Oracle.DataAccess.Client.OracleParameterCollection.GetParameter(Int32 index)
[1764] at System.Data.Common.DbParameterCollection.System.Collections.IList.get_Item(Int32 index)
[1764] at NHibernate.Type.Int32Type.Set(IDbCommand rs, Object value, Int32 index)
[1764] at NHibernate.Type.NullableType.NullSafeSet(IDbCommand cmd, Object value, Int32 index)
[1764] at NHibernate.Type.NullableType.NullSafeSet(IDbCommand st, Object value, Int32 index, ISessionImplementor session)
[1764] at NHibernate.Type.ComponentType.NullSafeSet(IDbCommand st, Object value, Int32 begin, ISessionImplementor session)
[1764] at NHibernate.Persister.Entity.AbstractEntityPersister.Dehydrate(Object id, Object[] fields, Object rowId, Boolean[] includeProperty, Boolean[][] includeColumns, Int32 table, IDbCommand statement, ISessionImplementor session, Int32 index)
[1764] at NHibernate.Persister.Entity.AbstractEntityPersister.Insert(Object id, Object[] fields, Boolean[] notNull, Int32 j, SqlCommandInfo sql, Object obj, ISessionImplementor session)
[1764] at NHibernate.Persister.Entity.AbstractEntityPersister.Insert(Object id, Object[] fields, Object obj, ISessionImplementor session)
[1764] at NHibernate.Action.EntityInsertAction.Execute()
[1764] at NHibernate.Engine.ActionQueue.Execute(IExecutable executable)
[1764] at NHibernate.Engine.ActionQueue.ExecuteActions(IList list)
[1764] at NHibernate.Engine.ActionQueue.ExecuteActions()
[1764] at NHibernate.Event.Default.AbstractFlushingEventListener.PerformExecutions(IEventSource session)
[1764] at NHibernate.Event.Default.DefaultFlushEventListener.OnFlush(FlushEvent event)
[1764] at NHibernate.Impl.SessionImpl.Flush()
[1764] at NHibernate.Transaction.AdoTransaction.Commit()


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.