I have a table structure that looks similar to this, simplified for brevity
CREATE TABLE Parent (
ParentId NUMBER NOT NULL,
CONSTRAINT ParentId_PK PRIMARY KEY ParentId
);
CREATE TABLE Attribute (
ParentId NUMBER NOT NULL,
Key NVARCHAR2(200) NOT NULL,
Value NVARCHAR2(4000) NOT NULL,
CONSTRAINT Attribute_PK PRIMARY KEY (ParentId, Key),
CONSTRAINT ParentId_FK FOREIGN KEY (ParentId)
REFERENCES Parent (ParentId)
);
I would like to map the child key and value to a name value pair and store the list as a dictionary in the mapping to the parent. Where the code would look like this:
public class Parent
{
public long Id { get; set; }
public Dictionary<string, string> Attributes { get; set; }
}
It seems that this should be possible, but I can't seem to figure out the proper mapping to place in the HBM file.