File tree Expand file tree Collapse file tree 4 files changed +88
-0
lines changed Expand file tree Collapse file tree 4 files changed +88
-0
lines changed Original file line number Diff line number Diff line change
1
+ using NUnit . Framework ;
2
+
3
+ namespace NHibernate . Test . NHSpecificTest . NH2241
4
+ {
5
+ [ TestFixture ]
6
+ public class Fixture : BugTestCase
7
+ {
8
+ protected override void OnSetUp ( )
9
+ {
10
+ using ( var session = OpenSession ( ) )
11
+ using ( var tran = session . BeginTransaction ( ) )
12
+ {
13
+ var country = new Country { CountryCode = "SE" , CountryName = "Sweden" } ;
14
+ session . Save ( country ) ;
15
+ tran . Commit ( ) ;
16
+ }
17
+ }
18
+
19
+ protected override void OnTearDown ( )
20
+ {
21
+ using ( var session = OpenSession ( ) )
22
+ using ( var tran = session . BeginTransaction ( ) )
23
+ {
24
+ session . Delete ( "from Country" ) ;
25
+ session . Delete ( "from User" ) ;
26
+ tran . Commit ( ) ;
27
+ }
28
+ }
29
+
30
+ [ Test ]
31
+ public void CanInsertUsingStatelessEvenWhenAssociatedEntityHasCacheStategy ( )
32
+ {
33
+ using ( var ss = Sfi . OpenStatelessSession ( ) )
34
+ using ( var tx = ss . BeginTransaction ( ) )
35
+ {
36
+ var user = new User ( ) ;
37
+ user . Country = new Country { CountryCode = "SE" , CountryName = "Sweden" } ;
38
+
39
+ ss . Insert ( user ) ;
40
+ tx . Commit ( ) ;
41
+ }
42
+ }
43
+ }
44
+ }
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.NH2241" >
5
+
6
+ <class name =" User" table =" Users" >
7
+ <id name =" Id" >
8
+ <generator class =" native" />
9
+ </id >
10
+
11
+ <many-to-one name =" Country" column =" CountryCode" cascade =" none" />
12
+ </class >
13
+
14
+ <class name =" Country" >
15
+ <cache region =" ShortTerm" usage =" read-write" />
16
+
17
+ <id name =" CountryCode" >
18
+ <generator class =" assigned" />
19
+ </id >
20
+
21
+ <property name =" CountryName" />
22
+
23
+ </class >
24
+
25
+ </hibernate-mapping >
Original file line number Diff line number Diff line change
1
+ namespace NHibernate . Test . NHSpecificTest . NH2241
2
+ {
3
+ public class User
4
+ {
5
+ public virtual int Id { get ; set ; }
6
+
7
+ public virtual Country Country { get ; set ; }
8
+ }
9
+
10
+ public class Country
11
+ {
12
+ public virtual string CountryCode { get ; set ; }
13
+
14
+ public virtual string CountryName { get ; set ; }
15
+ }
16
+ }
Original file line number Diff line number Diff line change 760
760
<Compile Include =" NHSpecificTest\EntityWithUserTypeCanHaveLinqGenerators\Fixture.cs" />
761
761
<Compile Include =" NHSpecificTest\EntityWithUserTypeCanHaveLinqGenerators\FooExample.cs" />
762
762
<Compile Include =" NHSpecificTest\EntityWithUserTypeCanHaveLinqGenerators\IExample.cs" />
763
+ <Compile Include =" NHSpecificTest\NH2241\Fixture.cs" />
764
+ <Compile Include =" NHSpecificTest\NH2241\Model.cs" />
763
765
<Compile Include =" Insertordering\NH3931Entities.cs" />
764
766
<Compile Include =" NHSpecificTest\NH4004\Entity.cs" />
765
767
<Compile Include =" NHSpecificTest\NH4004\Fixture.cs" />
3284
3286
<EmbeddedResource Include =" NHSpecificTest\NH1291AnonExample\Mappings.hbm.xml" />
3285
3287
</ItemGroup >
3286
3288
<ItemGroup >
3289
+ <EmbeddedResource Include =" NHSpecificTest\NH2241\Mappings.hbm.xml" />
3287
3290
<EmbeddedResource Include =" Futures\Mappings.hbm.xml" />
3288
3291
<EmbeddedResource Include =" SessionBuilder\Mappings.hbm.xml" />
3289
3292
<EmbeddedResource Include =" IdTest\IdentityClass.hbm.xml" />
You can’t perform that action at this time.
0 commit comments