Open
Description
I have a mapping for base class and derived
public class Document: ClassMap<Document>
{
public Document()
{
Table("documents");
// Mapping properties
Id(x => x.Id)
.Column("id")
.GeneratedBy.Sequence("documents_sequence");
DiscriminateSubClassesOnColumn("type");
}
}
public class Invoice: SubclassMap<Invoice>
{
public Invoice()
{
DiscriminatorValue((byte)DocumentType.Invoice);
Join("invoice", join =>
{
join.KeyColumn("id");
join.Fetch.Subselect();
join.Map(x => x.SomeField)
.Column("some_field")
.Length(255)
.Not.Nullable();
});
I use query to load documents
var partners = session.Query<Document>()
.ToList();
If I use join.Fetch.Join(); it makes outer join for table invoice. In case join.Fetch.Select(); query will make multiple select for each "document.id".
In case of multiple subclass tables it would be performance degradation for both Fetch.Join and Fetch.Select .
What I need is doing subselect to load all invoiced by using base document select.
How can I achive this ?
Metadata
Metadata
Assignees
Labels
No labels