We removed a primary key and converted it into composite key. The property was removed from Model and Fluent Mapping. The field was deleted from DB. Now when we fire QueryOver on Submission, it triggers an update and the update throws SQL Error: Invalid Column Name: 'SubmissionID'
Previous
public class Submission{
public virtual int SubmissionID{get;set;}
public virtual int CandidateID{get;set;}
public virtual int JobID{get;set;}
}
public class SubmissionMap:...{
public SubmissionMap(){
Id(x=>x.SubmissionID
}
}
Changed to
public class Submission{
public virtual Candidate Candidate{get;set;}
public virtual Job Job{get;set;}
}
public class SubmissionMap:...{
public SubmissionMap(){
CompositeId()
.KeyReference(x=>x.Job)
.KeyReference(x=>.Candidate);
}
}
After this change, Any update/insert on Submission is triggering a SQL Error: Invalid SubmissionID column
. We logged all the NHibernate SQL queries and none of them seem to have SubmissionID column.
As a temp fix, we have recreated the SubmissionID column, and the error goes away. We do have Redis 2nd level cache.
Well, are you still needing the Submission
entity at all? It looks now as a pure many-to-many relationship between Candidate and Job.
It could then be mapped without an intermediate entity. (See last example on this page too.)
If you have additional properties on Submission
, it is strange to give up its surrogate key for a composite one. This generally makes things harder for using an ORM. By example, you should now implement Submission
's id as a component. (See this blog for more explanation on why this, or read the whole composite-id
reference.)
Now about your actual question and trouble: sorry, with the facts available in your question, I have no clue on how this could be possible. Do you have some old trigger in DB messing around?