File tree Expand file tree Collapse file tree 4 files changed +113
-0
lines changed Expand file tree Collapse file tree 4 files changed +113
-0
lines changed Original file line number Diff line number Diff line change
1
+ using System ;
2
+ using System . Collections . Generic ;
3
+ using System . Linq ;
4
+ using System . Text ;
5
+
6
+ namespace NHibernate . Test . NHSpecificTest . NH3453
7
+ {
8
+ class Direction
9
+ {
10
+
11
+ #region Compisite ID
12
+
13
+ public virtual Int32 Id1 { get ; set ; }
14
+
15
+ public virtual Int32 Id2 { get ; set ; }
16
+
17
+ #endregion
18
+
19
+ public virtual Guid GUID { get ; set ; }
20
+
21
+ public override int GetHashCode ( )
22
+ {
23
+ return string . Format ( "{0} - {1}" , Id1 , Id2 ) . GetHashCode ( ) ;
24
+ }
25
+
26
+ public override bool Equals ( object obj )
27
+ {
28
+ return Id1 == ( ( Direction ) obj ) . Id1 &&
29
+ Id2 == ( ( Direction ) obj ) . Id2 ;
30
+ }
31
+ }
32
+
33
+ class DirectionReferrer
34
+ {
35
+ public virtual Guid GUID { get ; set ; }
36
+
37
+ public virtual Direction Direction { get ; set ; }
38
+ }
39
+ }
Original file line number Diff line number Diff line change
1
+ using System ;
2
+ using NUnit . Framework ;
3
+
4
+ namespace NHibernate . Test . NHSpecificTest . NH3453
5
+ {
6
+ [ TestFixture ]
7
+ public class Fixture : BugTestCase
8
+ {
9
+ public override string BugNumber
10
+ {
11
+ get { return "NH3453" ; }
12
+ }
13
+
14
+ [ Test ]
15
+ public void PropertyRefWithCompositeIdUpdateTest ( )
16
+ {
17
+ using ( var spy = new SqlLogSpy ( ) )
18
+ using ( var session = OpenSession ( ) )
19
+ using ( session . BeginTransaction ( ) )
20
+ {
21
+
22
+ var direction1 = new Direction { Id1 = 1 , Id2 = 1 , GUID = Guid . NewGuid ( ) } ;
23
+ session . Save ( direction1 ) ;
24
+
25
+ var direction2 = new Direction { Id1 = 2 , Id2 = 2 , GUID = Guid . NewGuid ( ) } ;
26
+ session . Save ( direction2 ) ;
27
+
28
+ session . Flush ( ) ;
29
+
30
+ var directionReferrer = new DirectionReferrer
31
+ {
32
+ GUID = Guid . NewGuid ( ) ,
33
+ Direction = direction1 ,
34
+ } ;
35
+
36
+ session . Save ( directionReferrer ) ;
37
+
38
+ directionReferrer . Direction = direction2 ;
39
+
40
+ session . Update ( directionReferrer ) ;
41
+
42
+ session . Flush ( ) ;
43
+
44
+ Console . WriteLine ( spy . ToString ( ) ) ;
45
+ Assert . That ( true ) ;
46
+ }
47
+ }
48
+
49
+ }
50
+ }
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" utf-8" ?>
2
+ <hibernate-mapping xmlns =" urn:nhibernate-mapping-2.2"
3
+ assembly=" NHibernate.Test"
4
+ namespace=" NHibernate.Test.NHSpecificTest.NH3453"
5
+ default-lazy=" false"
6
+ default-access =" property" >
7
+
8
+ <class name =" Direction" table =" Direction" >
9
+ <composite-id >
10
+ <key-property column =" Id1" name =" Id1" />
11
+ <key-property column =" Id2" name =" Id2" />
12
+ </composite-id >
13
+ <property column =" GUID" name =" GUID" not-null =" true" unique =" true" />
14
+ </class >
15
+
16
+ <class name =" DirectionReferrer" table =" DirectionReferrer" >
17
+ <id column =" GUID" name =" GUID" ></id >
18
+ <many-to-one name =" Direction" column =" guid_Direction" not-null =" false" property-ref =" GUID" />
19
+ </class >
20
+
21
+ </hibernate-mapping >
Original file line number Diff line number Diff line change 691
691
<Compile Include =" NHSpecificTest\BagWithLazyExtraAndFilter\Fixture.cs" />
692
692
<Compile Include =" Linq\ByMethod\DistinctTests.cs" />
693
693
<Compile Include =" Component\Basic\ComponentWithUniqueConstraintTests.cs" />
694
+ <Compile Include =" NHSpecificTest\NH3453\Classes.cs" />
695
+ <Compile Include =" NHSpecificTest\NH3453\Fixture.cs" />
694
696
<Compile Include =" NHSpecificTest\NH3480\Entity.cs" />
695
697
<Compile Include =" NHSpecificTest\NH3480\Fixture.cs" />
696
698
<Compile Include =" NHSpecificTest\NH3487\Entity.cs" />
3070
3072
<EmbeddedResource Include =" NHSpecificTest\NH1291AnonExample\Mappings.hbm.xml" />
3071
3073
</ItemGroup >
3072
3074
<ItemGroup >
3075
+ <EmbeddedResource Include =" NHSpecificTest\NH3453\Mappings.hbm.xml" />
3073
3076
<EmbeddedResource Include =" NHSpecificTest\NH3480\Mappings.hbm.xml" >
3074
3077
<SubType >Designer</SubType >
3075
3078
</EmbeddedResource >
You can’t perform that action at this time.
0 commit comments