File tree Expand file tree Collapse file tree 5 files changed +87
-1
lines changed
NHibernate/Persister/Entity Expand file tree Collapse file tree 5 files changed +87
-1
lines changed Original file line number Diff line number Diff line change
1
+ using System . Linq ;
2
+ using NHibernate . Linq ;
3
+ using NUnit . Framework ;
4
+
5
+ namespace NHibernate . Test . NHSpecificTest . NH2042
6
+ {
7
+ [ TestFixture ]
8
+ public class Fixture : BugTestCase
9
+ {
10
+ protected override void OnSetUp ( )
11
+ {
12
+ using ( var session = OpenSession ( ) )
13
+ using ( var transaction = session . BeginTransaction ( ) )
14
+ {
15
+ session . Save ( new Owner { Name = "Bob" } ) ;
16
+
17
+ session . Flush ( ) ;
18
+ transaction . Commit ( ) ;
19
+ }
20
+ }
21
+
22
+ protected override void OnTearDown ( )
23
+ {
24
+ using ( var session = OpenSession ( ) )
25
+ using ( var transaction = session . BeginTransaction ( ) )
26
+ {
27
+ session . Delete ( "from System.Object" ) ;
28
+
29
+ session . Flush ( ) ;
30
+ transaction . Commit ( ) ;
31
+ }
32
+ }
33
+
34
+ [ Test ]
35
+ public void TestPropertyOfOwnerShouldBeOne ( )
36
+ {
37
+ using ( var session = OpenSession ( ) )
38
+ using ( session . BeginTransaction ( ) )
39
+ {
40
+ var result = ( from e in session . Query < Person > ( )
41
+ where e . Name == "Bob"
42
+ select e ) . Single ( ) ;
43
+
44
+ Assert . That ( ( ( Owner ) result ) . Test , Is . EqualTo ( 1 ) ) ;
45
+ }
46
+ }
47
+ }
48
+ }
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" utf-8" ?>
2
+
3
+ <hibernate-mapping xmlns =" urn:nhibernate-mapping-2.2" assembly =" NHibernate.Test"
4
+ namespace =" NHibernate.Test.NHSpecificTest.NH2042" >
5
+ <class name =" Person" >
6
+ <id name =" Id" generator =" guid.comb" />
7
+ <discriminator column =" discriminator" type =" string" />
8
+ <property name =" Name" />
9
+ <subclass name =" Owner" >
10
+ <join table =" Owner" fetch =" select" >
11
+ <key column =" OwnerId" />
12
+ <property name =" SomeProperty" />
13
+ <property name =" Test" >
14
+ <formula >1</formula >
15
+ </property >
16
+ </join >
17
+ </subclass >
18
+ </class >
19
+ </hibernate-mapping >
Original file line number Diff line number Diff line change
1
+ using System ;
2
+
3
+ namespace NHibernate . Test . NHSpecificTest . NH2042
4
+ {
5
+ public class Person
6
+ {
7
+ public virtual Guid Id { get ; set ; }
8
+ public virtual string Name { get ; set ; }
9
+ }
10
+
11
+ public class Owner : Person
12
+ {
13
+ public virtual string SomeProperty { get ; set ; }
14
+ public virtual long Test { get ; set ; }
15
+ }
16
+ }
Original file line number Diff line number Diff line change 667
667
<Compile Include =" Component\Basic\ComponentWithUniqueConstraintTests.cs" />
668
668
<Compile Include =" NHSpecificTest\NH3374\Document.cs" />
669
669
<Compile Include =" NHSpecificTest\NH3374\FixtureByCode.cs" />
670
+ <Compile Include =" NHSpecificTest\NH2042\Model.cs" />
671
+ <Compile Include =" NHSpecificTest\NH2042\Fixture.cs" />
670
672
<Compile Include =" NHSpecificTest\Dates\DateTimeOffsetQueryFixture.cs" />
671
673
<Compile Include =" NHSpecificTest\NH3050\Fixture.cs" />
672
674
<Compile Include =" NHSpecificTest\NH3050\Person.cs" />
2862
2864
<EmbeddedResource Include =" NHSpecificTest\NH1291AnonExample\Mappings.hbm.xml" />
2863
2865
</ItemGroup >
2864
2866
<ItemGroup >
2867
+ <EmbeddedResource Include =" NHSpecificTest\NH2042\Mappings.hbm.xml" />
2865
2868
<EmbeddedResource Include =" NHSpecificTest\NH2860\Mappings.hbm.xml" />
2866
2869
<EmbeddedResource Include =" NHSpecificTest\NH3332\Mappings.hbm.xml" />
2867
2870
<EmbeddedResource Include =" NHSpecificTest\NH3050\Mappings.hbm.xml" />
Original file line number Diff line number Diff line change @@ -658,7 +658,7 @@ private SqlString GenerateSequentialSelect(ILoadable persister)
658
658
659
659
//figure out which formulas are needed (excludes lazy-properties)
660
660
List < int > formulaNumbers = new List < int > ( ) ;
661
- int [ ] formulaTableNumbers = SubclassColumnTableNumberClosure ;
661
+ int [ ] formulaTableNumbers = SubclassFormulaTableNumberClosure ;
662
662
for ( int i = 0 ; i < SubclassFormulaTemplateClosure . Length ; i ++ )
663
663
{
664
664
if ( tableNumbers . Contains ( formulaTableNumbers [ i ] ) )
You can’t perform that action at this time.
0 commit comments