views:

71

answers:

1

Hi,

In my current project, Workflows have comments. Please have a look at the following code.

[CompositeId]
[KeyProperty(1, Column = "datum", Name = "Date", TypeType = typeof(DateTime))]
[KeyManyToOne(1, Column = "workflow_id", Name = "Workflow", ClassType = typeof(Workflow))]        
 public virtual IWorkflow Workflow { get; set; }

 [Property(Column = "kommentar")]
 public virtual string CommentText { get; set; }

 public virtual DateTime Date { get; set; }

Down the bottom line this describes the relationship workflows(1)<---->(n)comments (one per date). When saving an entity of this type, the Database reports a constraint violation saying that column "datum" can't be null - which it ain't (the object has a value for it).

I thought defining a KeyProperty was sufficient for getting this field persisted, but obviously NHibernate sees it another way...

Does anybody see a mistake in this mapping?

A: 

I don't know whether this goes back to so ominous NH Bug, but it works now, without me having changed anything :(

Sebastian Edelmeier