Hi group,
I have a entity (Sample) that has a one-to-many-relationship with
SampleTest. SampleTest has a one-to-one relationship to abstract class
MaterialsTest .
Currently MaterialsTest(s) uses joined-subclass inheritance strategy
and there are about 13 or so implementations of class MaterialsTest.
This results in the monster query (below) which pulls all the
properties into the result set and does CASE statements to filter by
the MaterialsTest type.
I know the general wisdom is to avoid the <any> mapping and I sense I
am making it harder than it needs to be, so I wonder if anyone else
has tackled a similar sort of issue?
"Sample" is my aggregate root and SampleTests, though NH entities, are
really just value objects in my domain.
I hope this I am making somewhat clear my dilemma. Thanks for your
suggestions.
Mike
--current example select sql--
:
SELECT materialst0_.Id as
Id16_0_,
materialst0_.SampleTest as
SampleTest16_0_,
materialst0_.TestingInfo_TestedBy as
TestingI3_16_0_,
materialst0_.TestingInfo_OutsideLaboratory as
TestingI4_16_0_,
materialst0_.TestingInfo_TestedOn as
TestingI5_16_0_,
materialst0_.TestingInfo_Remarks as
TestingI6_16_0_,
materialst0_1_.UnitType_Value as
UnitType2_17_0_,
materialst0_1_.UnitGrade_Value as
UnitGrade3_17_0_,
materialst0_1_.UnitCategory_Value as
UnitCate4_17_0_,
materialst0_1_.UnitDescription_Value as
UnitDesc5_17_0_,
materialst0_1_.IsMissing as
IsMissing17_0_,
materialst0_2_.FamilyOfCurvesNumber as
FamilyOf2_21_0_,
materialst0_2_.MoldWeight as
MoldWeight21_0_,
materialst0_2_.MoldVolume as
MoldVolume21_0_,
materialst0_2_.IsMoldInPounds as
IsMoldIn5_21_0_,
materialst0_2_.MaximumDryDensity as
MaximumD6_21_0_,
materialst0_2_.OptimumMoisture as
OptimumM7_21_0_,
materialst0_2_.Method_Value as
Method8_21_0_,
materialst0_2_.Method_MethodCode_Value as
Method9_21_0_,
materialst0_2_.Method_MethodCode_Description as
Method10_21_0_,
materialst0_3_.WaterTemperature as
WaterTem2_23_0_,
materialst0_3_.Method_Value as
Method3_23_0_,
materialst0_3_.Method_MethodCode_Value as
Method4_23_0_,
materialst0_3_.Method_MethodCode_Description as
Method5_23_0_,
materialst0_3_.AverageDensityForCompaction_Value as
AverageD6_23_0_,
materialst0_3_.AverageDensityForCompaction_Source as
AverageD7_23_0_,
materialst0_3_.AverageRiceDensity_Value as
AverageR8_23_0_,
materialst0_3_.AverageRiceDensity_Source as
AverageR9_23_0_,
materialst0_4_.ConcreteSpecimenId as
Concrete2_27_0_,
materialst0_4_.TestRepresentsQuantity as
TestRepr3_27_0_,
materialst0_4_.FieldCuringConditions as
FieldCur4_27_0_,
materialst0_5_.Method_Value as
Method2_28_0_,
materialst0_6_.Method_Value as
Method2_30_0_,
materialst0_6_.RiceTest as
RiceTest30_0_,
materialst0_6_.Nini as
Nini30_0_,
materialst0_6_.Ndes as
Ndes30_0_,
materialst0_6_.Nmmx as
Nmmx30_0_,
materialst0_7_.Method_Value as
Method2_32_0_,
materialst0_7_.IsFanDried as
IsFanDried32_0_,
materialst0_7_.IsPortioned as
IsPortio4_32_0_,
materialst0_9_.IsNonPlastic as
IsNonPla2_36_0_,
materialst0_10_.LengthOfElectrode as
LengthOf2_39_0_,
materialst0_10_.WidthOfElectrode as
WidthOfE3_39_0_,
materialst0_10_.DistanceBetweenElectrodes as
Distance4_39_0_,
materialst0_11_.EstimatedFineSpecificGravity as
Estimate2_41_0_,
materialst0_11_.TareWeight as
TareWeight41_0_,
materialst0_11_.VolumeOfContainer as
VolumeOf4_41_0_,
materialst0_11_.RefFineSpecificGravity as
RefFineS5_41_0_,
materialst0_12_.Method_Value as
Method2_43_0_,
materialst0_12_.DryWeightPassCoarseSievingSplit as
DryWeigh3_43_0_,
materialst0_12_.CoarseAdjustment_AdjustedSieve_Value as
CoarseAd4_43_0_,
materialst0_12_.CoarseAdjustment_Delta as
CoarseAd5_43_0_,
materialst0_12_.FineAdjustment_AdjustedSieve_Value as
FineAdju6_43_0_,
materialst0_12_.FineAdjustment_Delta as
FineAdju7_43_0_,
materialst0_12_.WeightsRetainedTotal_CoarseTotal as
WeightsR8_43_0_,
materialst0_12_.WeightsRetainedTotal_FineTotal as
WeightsR9_43_0_,
materialst0_12_.WeightPass_Coarse as
WeightPass10_43_0_,
materialst0_12_.WeightPass_Fine as
WeightPass11_43_0_,
materialst0_13_.UnwashedWeight as
Unwashed2_45_0_,
materialst0_13_.WashedWeight as
WashedWe3_45_0_,
materialst0_13_.RecordedWeightPassCoarseScreening as
Recorded4_45_0_,
materialst0_14_.Plus3 as
Plus2_46_0_,
materialst0_14_.Plus6 as
Plus3_46_0_,
materialst0_15_.TotalWeight as
TotalWei2_47_0_,
materialst0_15_.WeightWithAtLeastOneFracturedFace as
WeightWi3_47_0_,
materialst0_15_.WeightWithAtLeastTwoFracturedFaces as
WeightWi4_47_0_,
materialst0_16_.DryWeight as
DryWeight48_0_,
materialst0_16_.WetWeight as
WetWeight48_0_,
materialst0_16_.IsRingSample as
IsRingSa4_48_0_,
materialst0_18_.Method_Value as
Method2_51_0_,
materialst0_18_.Method_MethodCode_Value as
Method3_51_0_,
materialst0_18_.Method_MethodCode_Description as
Method4_51_0_,
materialst0_18_.WetMassOfMoistureSample as
WetMassO5_51_0_,
materialst0_18_.DryMassOfMoistureSample as
DryMassO6_51_0_,
materialst0_18_.MassOfBasketAssembly as
MassOfBa7_51_0_,
materialst0_18_.MassOfBasketAssemblyAndSample as
MassOfBa8_51_0_,
materialst0_18_.ElapsedTimeOfTest as
ElapsedT9_51_0_,
materialst0_18_.Temperature_Fahrenheit as
Tempera10_51_0_,
materialst0_18_.Temperature_Celsius as
Tempera11_51_0_,
materialst0_18_.RecordedCorrectedAsphaltBinderContent as
Recorde12_51_0_,
materialst0_19_.MassOfOvenDrySampleInAir as
MassOfOv2_53_0_,
materialst0_19_.MassOfSaturatedSurfaceDrySampleInAir as
MassOfSa3_53_0_,
materialst0_19_.MassOfSaturatedSampleInWater as
MassOfSa4_53_0_,
materialst0_19_.MassOfPycnometerFilledWithWater as
MassOfPy5_53_0_,
materialst0_19_.MassOfPycnometerWithSampleAndWater as
MassOfPy6_53_0_,
materialst0_19_.Method_Value as
Method7_53_0_,
case
when materialst0_13_.Id is not null then 13
when materialst0_14_.Id is not null then 14
when materialst0_1_.Id is not null then 1
when materialst0_2_.Id is not null then 2
when materialst0_3_.Id is not null then 3
when materialst0_4_.Id is not null then 4
when materialst0_5_.Id is not null then 5
when materialst0_6_.Id is not null then 6
when materialst0_7_.Id is not null then 7
when materialst0_8_.Id is not null then 8
when materialst0_9_.Id is not null then 9
when materialst0_10_.Id is not null then 10
when materialst0_11_.Id is not null then 11
when materialst0_12_.Id is not null then 12
when materialst0_15_.Id is not null then 15
when materialst0_16_.Id is not null then 16
when materialst0_17_.Id is not null then 17
when materialst0_18_.Id is not null then 18
when materialst0_19_.Id is not null then 19
when materialst0_.Id is not null then 0
end as clazz_0_
FROM MaterialsTesting_Test.dbo.MaterialsTests materialst0_
left outer join
MaterialsTesting_Test.dbo.ConcreteMasonryUnitTests materialst0_1_
on materialst0_.Id = materialst0_1_.Id
left outer join MaterialsTesting_Test.dbo.ProctorTests
materialst0_2_
on materialst0_.Id = materialst0_2_.Id
left outer join MaterialsTesting_Test.dbo.BituminousCoreBatches
materialst0_3_
on materialst0_.Id = materialst0_3_.Id
left outer join
MaterialsTesting_Test.dbo.ConcreteStrengthTestGroups materialst0_4_
on materialst0_.Id = materialst0_4_.Id
left outer join
MaterialsTesting_Test.dbo.MarshallStabilityAndFlowTests materialst0_5_
on materialst0_.Id = materialst0_5_.Id
left outer join MaterialsTesting_Test.dbo.GyratoryDensityTests
materialst0_6_
on materialst0_.Id = materialst0_6_.Id
left outer join MaterialsTesting_Test.dbo.RiceTests
materialst0_7_
on materialst0_.Id = materialst0_7_.Id
left outer join
MaterialsTesting_Test.dbo.SoilAndAggregateCompositeTests
materialst0_8_
on materialst0_.Id = materialst0_8_.Id
left outer join MaterialsTesting_Test.dbo.PlasticityIndexTests
materialst0_9_
on materialst0_.Id = materialst0_9_.Id
left outer join MaterialsTesting_Test.dbo.ResistivityTests
materialst0_10_
on materialst0_.Id = materialst0_10_.Id
left outer join MaterialsTesting_Test.dbo.UncompactedVoidsTests
materialst0_11_
on materialst0_.Id = materialst0_11_.Id
left outer join MaterialsTesting_Test.dbo.SieveAnalysisTests
materialst0_12_
on materialst0_.Id = materialst0_12_.Id
left outer join
MaterialsTesting_Test.dbo.WashedSampleSieveAnalysisTests
materialst0_13_
on materialst0_.Id = materialst0_13_.Id
left outer join
MaterialsTesting_Test.dbo.OversizedSampleSieveAnalysisTests
materialst0_14_
on materialst0_.Id = materialst0_14_.Id
left outer join MaterialsTesting_Test.dbo.FracturedFacesTests
materialst0_15_
on materialst0_.Id = materialst0_15_.Id
left outer join MaterialsTesting_Test.dbo.MoistureContentTests
materialst0_16_
on materialst0_.Id = materialst0_16_.Id
left outer join MaterialsTesting_Test.dbo.SandEquivalentTests
materialst0_17_
on materialst0_.Id = materialst0_17_.Id
left outer join MaterialsTesting_Test.dbo.IgnitionFurnaceTests
materialst0_18_
on materialst0_.Id = materialst0_18_.Id
left outer join
MaterialsTesting_Test.dbo.SpecificGravityAndAbsorptionTests
materialst0_19_
on materialst0_.Id = materialst0_19_.Id
WHERE materialst0_.Id = '7a7e4bc9-066c-4b2d-9dbf-9bce018aed83' /* @p0
*/
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---