-->
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: Need help understanding this error message
PostPosted: Wed Jun 30, 2010 5:39 pm 
Newbie

Joined: Thu Jun 03, 2010 8:30 pm
Posts: 4
Hi, I'm using VS 2008, ASP.NET MVC with NHibernate 2.0. I get the following error of row not found when I retrieve collection of objects from 2 manyTomany tables. Here what is the "Identifier" 296 refers to? Is that the same as Application object with "Id" = 296? I search the manyTomany index table, ApplicationResearchInterests, and found no applicationId that equals to 296. Where is this coming from? Thank you.

- result Count = 21 System.Collections.Generic.IList<CtsiSearchMembership.Models.ResearchInterest> {System.Collections.Generic.List<CtsiSearchMembership.Models.ResearchInterest>}
- [0] {CtsiSearchMembership.Models.ResearchInterest} CtsiSearchMembership.Models.ResearchInterest
+ applications {NHibernate.Collection.Generic.PersistentGenericBag<CtsiSearchMembership.Models.Application>} System.Collections.Generic.IList<CtsiSearchMembership.Models.Application> {NHibernate.Collection.Generic.PersistentGenericBag<CtsiSearchMembership.Models.Application>}
Id 2 long
Name "Anatomical Systems or Sites" string
+ ParentResearchInterest {CtsiSearchMembership.Models.ResearchInterest} CtsiSearchMembership.Models.ResearchInterest
- [1] {CtsiSearchMembership.Models.ResearchInterest} CtsiSearchMembership.Models.ResearchInterest
- applications {NHibernate.Collection.Generic.PersistentGenericBag<CtsiSearchMembership.Models.Application>} System.Collections.Generic.IList<CtsiSearchMembership.Models.Application> {NHibernate.Collection.Generic.PersistentGenericBag<CtsiSearchMembership.Models.Application>}
- base {"No row with the given identifier exists[CtsiSearchMembership.Models.Application#296]"} NHibernate.UnresolvableObjectException {NHibernate.ObjectNotFoundException}
+ base {"No row with the given identifier exists[CtsiSearchMembership.Models.Application#296]"} NHibernate.HibernateException {NHibernate.ObjectNotFoundException}
EntityName "CtsiSearchMembership.Models.Application" string
Identifier 296 object {long}
Message "No row with the given identifier exists[CtsiSearchMembership.Models.Application#296]" string
+ PersistentClass null System.Type
+ Non-Public members
+ Raw View
Id 33 long
Name "Biomedical Engineering" string
+ ParentResearchInterest {CtsiSearchMembership.Models.ResearchInterest} CtsiSearchMembership.Models.ResearchInterest

Here are the 2 mappings for my 2 manyTomany tables:

using CtsiSearchMembership.Models;
using FluentNHibernate.Mapping;

namespace CtsiSearchMembership.ModelMapping
{
public class ApplicationMap: ClassMap<Application>
{
public ApplicationMap()
{
WithTable("Applications");
Id(x => x.Id);
Map(x => x.FirstName);
Map(x => x.LastName);
Map(x => x.EmailAddress);
Map(x => x.PhoneNumber);
Map(x => x.MailingAddressLine1);
Map(x => x.MailingAddressLine2);
Map(x => x.MailingAddressCity);
Map(x => x.MailingAddressState);
Map(x => x.MailingAddressZip);
Map(x => x.Institution);
Map(x => x.InstitutionOther);
Map(x => x.CommunityOrganization);
References(x => x.Title);
Map(x => x.TitleOther);
Map(x => x.Department);
Map(x => x.ProfessionalOrganizations);
Map(x => x.MembershipLevel);
Map(x => x.MembershipReasonOther);
Map(x => x.PhdTraineeCount);
Map(x => x.MscTraineeCount);
Map(x => x.Gender);
Map(x => x.YearOfBirth);
Map(x => x.Race);
Map(x => x.RaceOther);
Map(x => x.Ethnicity);

//Many to Many mappings
//HasManyToMany<ResearchInterest>(x => x.ResearchInterests).Cascade.All().WithTableName(
// "ApplicationResearchInterests");
HasManyToMany<ResearchInterest>(x => x.ResearchInterests).AsBag().Not.LazyLoad().NotFound.Ignore().WithTableName(
"ApplicationResearchInterests").WithParentKeyColumn("ApplicationId").WithChildKeyColumn(
"ResearchInterestId");
HasManyToMany<Degree>(x => x.Degrees).AsBag().WithTableName("ApplicationDegrees").WithParentKeyColumn(
"ApplicationId").WithChildKeyColumn("DegreeId");
HasManyToMany<MembershipReason>(x => x.MembershipReasons).AsBag().WithTableName(
"ApplicationMembershipReasons").WithParentKeyColumn("ApplicationId").WithChildKeyColumn(
"MembershipReasonId");
HasManyToMany<MembershipServiceRequirement>(x => x.MembershipServiceRequirements).AsBag().WithTableName(
"ApplicationMembershipServiceRequirements").WithParentKeyColumn("ApplicationId").WithChildKeyColumn(
"MembershipServiceRequirementId");
}
}
}


using FluentNHibernate.Mapping;
using CtsiSearchMembership.Models;

namespace CtsiSearchMembership.ModelMapping
{
public class ResearchInterestMap : ClassMap<ResearchInterest>
{
public ResearchInterestMap()
{
WithTable("ResearchInterests");
Id(x => x.Id);
Map(x => x.Name);
References(x => x.ParentResearchInterest);
//HasManyToMany<Application>(x => x.applications).Cascade.All().Inverse().WithTableName(
// "ApplicationResearchInterests");
HasManyToMany<Application>(x => x.applications).AsBag().WithTableName(
"ApplicationResearchInterests").WithParentKeyColumn("ApplicationId").WithChildKeyColumn(
"ResearchInterestId");
}
}
}


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.