Could NHibernate cause such problem below? I have a manyTomany relationship for the 2 tables. Does this declaration looks about right? Thank you.
public class ResearchInterestMap : ClassMap<ResearchInterest>
{
public ResearchInterestMap()
{
WithTable("ResearchInterests");
Id(x => x.Id);
Map(x => x.Name);
References(x => x.ParentResearchInterest);
HasManyToMany(x => x.applications).AsBag().WithTableName(
"ApplicationResearchInterests").WithParentKeyColumn("ResearchInterestId").WithChildKeyColumn(
"ApplicationId").Cascade.All();
}
}
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);
HasManyToMany(x => x.ResearchInterests).AsBag().WithTableName(
"ApplicationResearchInterests").WithParentKeyColumn("ApplicationId").WithChildKeyColumn(
"ResearchInterestId").Inverse();
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");
}
Hi, I'm using V.S. 2008, .net 3.5, NHibernate 2.0. You can see the page at
http://www.labctsi.org/Members/SearchMembers.aspx/IndexAfter my $.getJSON call to retrieve data, I can see many records are retrieved in my debug mode in the "result". As I step through the code after the "return this.Json(result);", (This is is in my controller file)
public JsonResult GetChildResearchInterests(long id)
{
var result = ResearchInterestRepository.FindByParentResearchInterestId(id);
return this.Json(result);
}
it went into the Application constructor code,
public Application()
{
ResearchInterests = new List<ResearchInterest>();
Degrees = new List<Degree>();
MembershipReasons = new List<MembershipReason>();
MembershipServiceRequirements = new List<MembershipServiceRequirement>();
}
after which I click the Continue arrow then nothing happens. The script on my View side is supposed to construct a 2nd Select control based on the data retrieved but nothing happens. In Firebug, no script is run and no error is reported. how can I find out what happened here and how to fix this? Also, why was the Application constructor code being stepped though? Thank you.
$("#level1ResearchInterests").change(function() {
$.getJSON("/SearchMembers.aspx/GetChildResearchInterests/" + $(this).val(), Populate);
$('#level3ResearchInterests').fadeOut('fast');
$('#level4ResearchInterests').fadeOut('fast');
});
function Populate(json) {
alert("1st result : " + json[0].Name);
if (json.length <= 0)
alert("Nothing returned");
else
alert("results returned = " + json.length);
var options = '';
for (var i = 0; i < json.length; i++) {
options += '<option value="' + json[i].Id + '">' + json[i].Name + '</option>';
}
$("#level2ResearchInterests").html(options);
$("#level3ResearchInterests").html('');
$("#level4ResearchInterests").html('');
if (json.length > 0) {
$('#level1ResearchInterests').animate({ width: 170 }, 'fast', function() {
$('#level2ResearchInterests').css('width', '340px');
$('#level2ResearchInterests').fadeIn('fast');
})
}
}