You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
(248) |
May
(82) |
Jun
(90) |
Jul
(177) |
Aug
(253) |
Sep
(157) |
Oct
(151) |
Nov
(143) |
Dec
(278) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(152) |
Feb
(107) |
Mar
(177) |
Apr
(133) |
May
(259) |
Jun
(81) |
Jul
(119) |
Aug
(306) |
Sep
(416) |
Oct
(240) |
Nov
(329) |
Dec
(206) |
2006 |
Jan
(466) |
Feb
(382) |
Mar
(153) |
Apr
(162) |
May
(133) |
Jun
(21) |
Jul
(18) |
Aug
(37) |
Sep
(97) |
Oct
(114) |
Nov
(110) |
Dec
(28) |
2007 |
Jan
(74) |
Feb
(65) |
Mar
(49) |
Apr
(76) |
May
(43) |
Jun
(15) |
Jul
(68) |
Aug
(55) |
Sep
(63) |
Oct
(59) |
Nov
(70) |
Dec
(66) |
2008 |
Jan
(71) |
Feb
(60) |
Mar
(120) |
Apr
(31) |
May
(48) |
Jun
(81) |
Jul
(107) |
Aug
(51) |
Sep
(80) |
Oct
(83) |
Nov
(83) |
Dec
(79) |
2009 |
Jan
(83) |
Feb
(110) |
Mar
(97) |
Apr
(91) |
May
(291) |
Jun
(250) |
Jul
(197) |
Aug
(58) |
Sep
(54) |
Oct
(122) |
Nov
(68) |
Dec
(34) |
2010 |
Jan
(50) |
Feb
(17) |
Mar
(63) |
Apr
(61) |
May
(84) |
Jun
(81) |
Jul
(138) |
Aug
(144) |
Sep
(78) |
Oct
(26) |
Nov
(30) |
Dec
(61) |
2011 |
Jan
(33) |
Feb
(35) |
Mar
(166) |
Apr
(221) |
May
(109) |
Jun
(76) |
Jul
(27) |
Aug
(37) |
Sep
(1) |
Oct
(4) |
Nov
(2) |
Dec
(1) |
2012 |
Jan
|
Feb
|
Mar
(2) |
Apr
(2) |
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
(1) |
Oct
|
Nov
(1) |
Dec
|
2013 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
(1) |
Sep
(3) |
Oct
(2) |
Nov
|
Dec
(1) |
2014 |
Jan
(1) |
Feb
(1) |
Mar
(3) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Michael D. <mik...@us...> - 2005-03-29 05:33:23
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Collection In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8599/NHibernate/Collection Modified Files: PersistentCollection.cs Set.cs Log Message: NH-233: Implement AddAll on Set. Index: PersistentCollection.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Collection/PersistentCollection.cs,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** PersistentCollection.cs 26 Mar 2005 15:33:32 -0000 1.24 --- PersistentCollection.cs 29 Mar 2005 05:33:15 -0000 1.25 *************** *** 167,182 **** } - // TODO: h2.0.3 synhc - I don't see AddAll in the H code... - // NB This is needed by Set/SortedSet to fulfil ISet contract - /// <summary> - /// - /// </summary> - /// <param name="coll"></param> - /// <returns></returns> - public virtual bool AddAll( ICollection coll ) - { - throw new AssertionFailure( "Collection does not support delayed initialization" ); - } - /// <summary> /// Gets or Sets an <see cref="ArrayList"/> of objects that have been placed in the Queue --- 167,170 ---- Index: Set.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Collection/Set.cs,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** Set.cs 14 Mar 2005 18:51:49 -0000 1.27 --- Set.cs 29 Mar 2005 05:33:15 -0000 1.28 *************** *** 220,223 **** --- 220,241 ---- } + /// <summary> + /// + /// </summary> + /// <param name="coll"></param> + /// <returns></returns> + public bool AddAll( ICollection coll ) + { + if( coll.Count > 0 ) + { + Write(); + return internalSet.AddAll( coll ); + } + else + { + return false; + } + } + /// <summary></summary> public void Clear() |
From: Michael D. <mik...@us...> - 2005-03-29 05:33:23
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8599/NHibernate.Test Modified Files: FooBarTest.cs Log Message: NH-233: Implement AddAll on Set. Index: FooBarTest.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/FooBarTest.cs,v retrieving revision 1.88 retrieving revision 1.89 diff -C2 -d -r1.88 -r1.89 *** FooBarTest.cs 26 Mar 2005 14:10:51 -0000 1.88 --- FooBarTest.cs 29 Mar 2005 05:33:14 -0000 1.89 *************** *** 3754,3757 **** --- 3754,3790 ---- } } + + + /// <summary> + /// This test verifies that the AddAll() method works + /// correctly for a persistent Set. + /// </summary> + [Test] + public void AddAll() + { + using (ISession s = sessions.OpenSession()) + { + Foo foo1 = new Foo(); + s.Save(foo1); + Foo foo2 = new Foo(); + s.Save(foo2); + Foo foo3 = new Foo(); + s.Save(foo3); + Baz baz = new Baz(); + baz.FooSet = new Iesi.Collections.HashedSet(); + baz.FooSet.Add(foo1); + s.Save(baz); + Assert.AreEqual(1, baz.FooSet.Count); + + IList foos = new ArrayList(); + foos.Add(foo2); + foos.Add(foo3); + baz.FooSet.AddAll(foos); + Assert.AreEqual(3, baz.FooSet.Count); + + s.Flush(); + } + } + } } |
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Persister In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19681/nhibernate/src/NHibernate/Persister Modified Files: AbstractEntityPersister.cs EntityPersister.cs ILoadable.cs IQueryable.cs NormalizedEntityPersister.cs Log Message: NH-237 - Allow for Null/Not Null discriminator Index: NormalizedEntityPersister.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Persister/NormalizedEntityPersister.cs,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** NormalizedEntityPersister.cs 28 Mar 2005 10:23:53 -0000 1.43 --- NormalizedEntityPersister.cs 28 Mar 2005 15:20:44 -0000 1.44 *************** *** 639,643 **** /// <summary></summary> ! public override IDiscriminatorType DiscriminatorType { get { return discriminatorType; } --- 639,643 ---- /// <summary></summary> ! public override IType DiscriminatorType { get { return discriminatorType; } Index: AbstractEntityPersister.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Persister/AbstractEntityPersister.cs,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** AbstractEntityPersister.cs 28 Mar 2005 10:23:53 -0000 1.37 --- AbstractEntityPersister.cs 28 Mar 2005 15:20:42 -0000 1.38 *************** *** 1349,1353 **** /// <summary></summary> - /// <remarks>This is the 2.1 version, DiscriminatorSQLString will be redunant shortly</remarks> public abstract object DiscriminatorSQLValue{ get; } --- 1349,1352 ---- *************** *** 1600,1604 **** /// <summary></summary> ! public abstract IDiscriminatorType DiscriminatorType { get; } /// <summary> --- 1599,1603 ---- /// <summary></summary> ! public abstract IType DiscriminatorType { get; } /// <summary> Index: EntityPersister.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Persister/EntityPersister.cs,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** EntityPersister.cs 28 Mar 2005 10:23:53 -0000 1.40 --- EntityPersister.cs 28 Mar 2005 15:20:44 -0000 1.41 *************** *** 64,68 **** private readonly bool forceDiscriminator; private readonly string discriminatorColumnName; ! private readonly IDiscriminatorType discriminatorType; private readonly string discriminatorAlias; private readonly object discriminatorSQLValue; --- 64,68 ---- private readonly bool forceDiscriminator; private readonly string discriminatorColumnName; ! private readonly IType discriminatorType; private readonly string discriminatorAlias; private readonly object discriminatorSQLValue; *************** *** 112,116 **** discriminatorAlias = discColumn.Alias( Dialect ); } ! discriminatorType = ( IDiscriminatorType ) model.Discriminator.Type; if( model.IsDiscriminatorValueNull ) --- 112,116 ---- discriminatorAlias = discColumn.Alias( Dialect ); } ! discriminatorType = model.Discriminator.Type; if( model.IsDiscriminatorValueNull ) *************** *** 131,135 **** try { ! IDiscriminatorType dtype = ( IDiscriminatorType ) model.Discriminator.Type; discriminatorValue = dtype.StringToObject( model.DiscriminatorValue ); discriminatorSQLValue = dtype.ObjectToSQLString( discriminatorValue ); --- 131,135 ---- try { ! IDiscriminatorType dtype = ( IDiscriminatorType )discriminatorType; discriminatorValue = dtype.StringToObject( model.DiscriminatorValue ); discriminatorSQLValue = dtype.ObjectToSQLString( discriminatorValue ); *************** *** 160,164 **** discriminatorColumnName = null; discriminatorAlias = null; - discriminatorValue = null; discriminatorType = null; discriminatorValue = null; --- 160,163 ---- *************** *** 289,300 **** if( model.IsPolymorphic ) { ! if( discriminatorValue == null ) ! { ! subclassesByDiscriminatorValue.Add( ObjectUtils.Null, mappedClass ); ! } ! else ! { ! subclassesByDiscriminatorValue.Add( discriminatorValue, mappedClass ); ! } } --- 288,292 ---- if( model.IsPolymorphic ) { ! subclassesByDiscriminatorValue.Add( discriminatorValue, mappedClass ); } *************** *** 318,323 **** try { subclassesByDiscriminatorValue.Add( ! discriminatorType.StringToObject( sc.DiscriminatorValue ), sc.MappedClass ); } --- 310,316 ---- try { + IDiscriminatorType dtype = discriminatorType as IDiscriminatorType; subclassesByDiscriminatorValue.Add( ! dtype.StringToObject( sc.DiscriminatorValue ), sc.MappedClass ); } *************** *** 476,480 **** /// <summary></summary> ! public override IDiscriminatorType DiscriminatorType { get { return discriminatorType; } --- 469,473 ---- /// <summary></summary> ! public override IType DiscriminatorType { get { return discriminatorType; } Index: IQueryable.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Persister/IQueryable.cs,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** IQueryable.cs 28 Mar 2005 10:23:53 -0000 1.12 --- IQueryable.cs 28 Mar 2005 15:20:44 -0000 1.13 *************** *** 24,35 **** System.Type MappedSuperclass { get; } - /* - /// <summary> - /// The discriminator value for this particular concrete subclass, as a string that may be - /// embedded in a select statement - /// </summary> - string DiscriminatorSQLString { get; } - */ - /// <summary> /// The discriminator value for this particular concrete subclass, as a string that may be --- 24,27 ---- Index: ILoadable.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Persister/ILoadable.cs,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** ILoadable.cs 14 Mar 2005 18:53:15 -0000 1.10 --- ILoadable.cs 28 Mar 2005 15:20:44 -0000 1.11 *************** *** 19,23 **** /// The discriminator type /// </summary> ! IDiscriminatorType DiscriminatorType { get; } /// <summary> --- 19,23 ---- /// The discriminator type /// </summary> ! IType DiscriminatorType { get; } /// <summary> |
From: Paul H. <pha...@us...> - 2005-03-28 15:21:27
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/SqlCommand In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19681/nhibernate/src/NHibernate/SqlCommand Modified Files: InFragment.cs Log Message: NH-237 - Allow for Null/Not Null discriminator Index: InFragment.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/SqlCommand/InFragment.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** InFragment.cs 28 Mar 2005 10:23:54 -0000 1.5 --- InFragment.cs 28 Mar 2005 15:20:46 -0000 1.6 *************** *** 107,111 **** else { ! string value = values[ 0 ] as string; if( Null.Equals( value ) ) { --- 107,111 ---- else { ! object value = values[ 0 ]; if( Null.Equals( value ) ) { |
From: Paul H. <pha...@us...> - 2005-03-28 15:21:26
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Loader In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19681/nhibernate/src/NHibernate/Loader Modified Files: Loader.cs Log Message: NH-237 - Allow for Null/Not Null discriminator Index: Loader.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Loader/Loader.cs,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** Loader.cs 14 Mar 2005 18:53:03 -0000 1.50 --- Loader.cs 28 Mar 2005 15:20:41 -0000 1.51 *************** *** 720,724 **** if( result == null ) { ! // woops we got an instance of another class heirarchy branch. throw new WrongClassException( "Discriminator: " + discriminatorValue, id, topClass ); } --- 720,724 ---- if( result == null ) { ! // woops we got an instance of another class hierarchy branch. throw new WrongClassException( "Discriminator: " + discriminatorValue, id, topClass ); } |
From: Paul H. <pha...@us...> - 2005-03-28 15:21:20
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19681/nhibernate/src/NHibernate/Impl Modified Files: SessionImpl.cs Log Message: NH-237 - Allow for Null/Not Null discriminator Index: SessionImpl.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl/SessionImpl.cs,v retrieving revision 1.78 retrieving revision 1.79 diff -C2 -d -r1.78 -r1.79 *** SessionImpl.cs 28 Mar 2005 10:19:39 -0000 1.78 --- SessionImpl.cs 28 Mar 2005 15:20:28 -0000 1.79 *************** *** 3465,3468 **** --- 3465,3472 ---- { object oid = persister.GetIdentifier( obj ); + if ( id == null ) + { + throw new AssertionFailure( "null id in entry (don't flush the Session after an exception occurs)" ); + } if( !id.Equals( oid ) ) |
From: Paul H. <pha...@us...> - 2005-03-28 15:21:16
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19681/nhibernate/src/NHibernate.Test Modified Files: MasterDetailTest.cs Log Message: NH-237 - Allow for Null/Not Null discriminator Index: MasterDetailTest.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/MasterDetailTest.cs,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** MasterDetailTest.cs 28 Mar 2005 10:24:44 -0000 1.19 --- MasterDetailTest.cs 28 Mar 2005 15:20:27 -0000 1.20 *************** *** 64,70 **** [Test] - [Ignore( "Test not written" )] public void NotNullDiscriminator() { } --- 64,95 ---- [Test] public void NotNullDiscriminator() { + ISession s = sessions.OpenSession(); + ITransaction t = s.BeginTransaction(); + Up up = new Up(); + up.Id1 = "foo"; + up.Id2 = 1231; + Down down = new Down(); + down.Id1 = "foo"; + down.Id2 = 3211; + down.Value = 123123121; + s.Save( up ); + s.Save( down ); + t.Commit(); + s.Close(); + + s = sessions.OpenSession(); + t = s.BeginTransaction(); + IList list = s.Find( "from Up up order by up.Id2 asc" ); + Assert.IsTrue( list.Count == 2 ); + Assert.IsFalse( list[0] is Down ); + Assert.IsTrue( list[1] is Down ); + list = s.Find( "from Down down" ); + Assert.IsTrue( list.Count == 1 ); + Assert.IsTrue( list[0] is Down ); + s.Delete( "from Up up" ); + t.Commit(); + s.Close(); } |
From: Paul H. <pha...@us...> - 2005-03-28 15:21:16
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.DomainModel In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19681/nhibernate/src/NHibernate.DomainModel Modified Files: Up.cs Log Message: NH-237 - Allow for Null/Not Null discriminator Index: Up.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.DomainModel/Up.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Up.cs 28 Mar 2005 10:16:20 -0000 1.1 --- Up.cs 28 Mar 2005 15:20:27 -0000 1.2 *************** *** 30,33 **** --- 30,50 ---- } + /// <summary> + /// + /// </summary> + /// <param name="other"></param> + /// <returns></returns> + /// <remarks>This is important, otherwise the Identifier and Instance don't match inside SessionImpl</remarks> + public override bool Equals( object other ) + { + if ( !(other is Up) ) + { + return false; + } + Up that = other as Up; + + return this.id1.Equals( that.id1 ) && this.id2.Equals( that.id2 ); + } + public int GetHashcode() { |
From: Paul H. <pha...@us...> - 2005-03-28 12:46:12
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6075/nhibernate/src/NHibernate Modified Files: NHibernate-1.1.csproj Log Message: NH-112 - Query by Example Index: NHibernate-1.1.csproj =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/NHibernate-1.1.csproj,v retrieving revision 1.77 retrieving revision 1.78 diff -C2 -d -r1.77 -r1.78 *** NHibernate-1.1.csproj 14 Mar 2005 18:55:03 -0000 1.77 --- NHibernate-1.1.csproj 28 Mar 2005 12:45:57 -0000 1.78 *************** *** 785,788 **** --- 785,793 ---- /> <File + RelPath = "Expression\Example.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "Expression\Expression.cs" SubType = "Code" *************** *** 850,853 **** --- 855,863 ---- /> <File + RelPath = "Expression\MatchMode.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "Expression\NotExpression.cs" SubType = "Code" *************** *** 2065,2068 **** --- 2075,2083 ---- /> <File + RelPath = "Type\EnumType.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "Type\GuidType.cs" SubType = "Code" |
From: Paul H. <pha...@us...> - 2005-03-28 12:46:12
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/ExpressionTest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6075/nhibernate/src/NHibernate.Test/ExpressionTest Added Files: QueryByExampleTest.cs Log Message: NH-112 - Query by Example --- NEW FILE: QueryByExampleTest.cs --- using System; using System.Collections; using NHibernate.DomainModel; using NHibernate.Expression; using NUnit.Framework; namespace NHibernate.Test.ExpressionTest { /// <summary> /// Summary description for QueryByExampleTest. /// </summary> [TestFixture] public class QueryByExampleTest : TestCase { public QueryByExampleTest() { // // TODO: Add constructor logic here // } [SetUp] public void SetUp() { ExportSchema( new string[] { "Componentizable.hbm.xml"}); initData(); } [Test] public void TestSimpleQBE() { ISession s = sessions.OpenSession(); ITransaction t = s.BeginTransaction(); Componentizable master = GetMaster("hibernate", null, "ope%"); ICriteria crit = s.CreateCriteria(typeof(Componentizable)); Example ex = Example.create(master).EnableLike(); crit.Add(ex); IList result = crit.List(); Assertion.AssertNotNull(result); Assertion.AssertEquals(1, result.Count); t.Commit(); s.Close(); } [Test] [Ignore("Test Fails with Exception - do to with Criteria parameter handling")] public void TestJunctionNotExpressionQBE() { ISession s = sessions.OpenSession(); ITransaction t = s.BeginTransaction(); Componentizable master = GetMaster("hibernate", null, "ope%"); ICriteria crit = s.CreateCriteria(typeof(Componentizable)); Example ex = Example.create(master).EnableLike(); crit.Add(Expression.Expression.Or(Expression.Expression.Not(ex), ex)); IList result = crit.List(); Assertion.AssertNotNull(result); // if (!(GetDialect() // instanceof HSQLDialect) ) // assertEquals(2, result.size()); t.Commit(); s.Close(); } [Test] public void TestExcludingQBE() { ISession s = sessions.OpenSession(); ITransaction t = s.BeginTransaction(); Componentizable master = GetMaster("hibernate", null, "ope%"); ICriteria crit = s.CreateCriteria(typeof(Componentizable)); Example ex = Example.create(master).EnableLike() .ExcludeProperty("Component.SubComponent"); crit.Add(ex); IList result = crit.List(); Assertion.AssertNotNull(result); Assertion.AssertEquals(3, result.Count); master = GetMaster("hibernate", "ORM tool", "fake stuff"); crit = s.CreateCriteria(typeof(Componentizable)); ex = Example.create(master).EnableLike() .ExcludeProperty("Component.SubComponent.SubName1"); crit.Add(ex); result = crit.List(); Assertion.AssertNotNull(result); Assertion.AssertEquals(1, result.Count); t.Commit(); s.Close(); } private void initData() { ISession s = sessions.OpenSession(); Componentizable master = GetMaster("hibernate", "ORM tool", "ORM tool1"); s.Save(master); s.Close(); s = sessions.OpenSession(); master = GetMaster("hibernate", "open source", "open source1"); s.Save(master); s.Close(); s = sessions.OpenSession(); master = GetMaster("hibernate", null, null); s.Save(master); s.Close(); } private void deleteData() { ISession s = sessions.OpenSession(); ITransaction t = s.BeginTransaction(); s.Delete("from Componentizable"); t.Commit(); s.Close(); } private Componentizable GetMaster(String name, String subName, String subName1) { Componentizable master = new Componentizable(); if (name != null) { Component masterComp = new Component(); masterComp.Name = name; if (subName != null || subName1 != null) { SubComponent subComponent = new SubComponent(); subComponent.SubName = subName; subComponent.SubName1 = subName1; masterComp.SubComponent = subComponent; } master.Component = masterComp; } return master; } } } |
From: Paul H. <pha...@us...> - 2005-03-28 12:46:12
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Expression In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6075/nhibernate/src/NHibernate/Expression Added Files: Example.cs MatchMode.cs Log Message: NH-112 - Query by Example --- NEW FILE: Example.cs --- using System; using System.Collections; using System.Text; using Iesi.Collections; using NHibernate; using NHibernate.Collection; using NHibernate.Engine; using NHibernate.Metadata; using NHibernate.SqlCommand; using NHibernate.Type; using NHibernate.Util; namespace NHibernate.Expression { /// <summary> /// Summary description for Example. /// </summary> public class Example : Expression { private object entity; private ISet excludedProperties = new HashedSet(); private PropertySelector selector; private bool isLikeEnabled; private MatchMode matchMode; private Conjunction expressions = new Conjunction(); /// <summary> /// A strategy for choosing property values for inclusion in the query criteria /// </summary> public interface PropertySelector { /// <summary> /// /// </summary> /// <param name="propertyValue"></param> /// <param name="propertyName"></param> /// <param name="type"></param> /// <returns></returns> bool Include(object propertyValue, String propertyName, IType type); } private static readonly PropertySelector NOT_NULL_OR_EMPTY_STRING = new NotNullOrEmptyStringPropertySelector(); private static readonly PropertySelector ALL = new AllPropertySelector(); private static readonly PropertySelector NOT_NULL_OR_ZERO = new NotNullOrZeroPropertySelector(); private class AllPropertySelector : PropertySelector { public bool Include(object propertyValue, String propertyName, IType type) { return true; } } internal class NotNullOrEmptyStringPropertySelector : PropertySelector { public bool Include(object propertyValue, String propertyName, IType type) { if(propertyValue != null) { if(propertyValue.ToString() != "") return true; else return false; } else return false; } } /// <summary> /// This Can't work right now. Have to figure out some way to use Magic values /// to avoid the non-nullable types in .NET. /// </summary> internal class NotNullOrZeroPropertySelector : PropertySelector { public bool Include(object propertyValue, String propertyName, IType type) { return propertyValue!=null ;/*&& (!char.IsNumber(propertyValue as char) || ( (int) propertyValue !=0));*/ } } /// <summary> /// Set the property selector /// </summary> public Example SetPropertySelector(PropertySelector selector) { this.selector = selector; return this; } /// <summary> /// Exclude zero-valued properties /// </summary> public Example ExcludeNulls() { SetPropertySelector(NOT_NULL_OR_EMPTY_STRING); return this; } /// <summary> /// Don't exclude null or zero-valued properties /// </summary> public Example ExcludeNone() { SetPropertySelector(ALL); return this; } /// <summary> /// Use the "like" operator for all string-valued properties /// </summary> public Example EnableLike(MatchMode matchMode) { isLikeEnabled = true; this.matchMode = matchMode; return this; } /// <summary> /// Use the "like" operator for all string-valued properties /// </summary> public Example EnableLike() { return EnableLike(MatchMode.EXACT); } /// <summary> /// Exclude a particular named property /// </summary> public Example ExcludeProperty(String name) { excludedProperties.Add(name); return this; } /// <summary> /// Create a new instance, which includes all non-null properties /// by default /// </summary> /// <param name="entity"></param> /// <returns>a new instance of <code>Example</code></returns> public static Example create(object entity) { if (entity==null) throw new ArgumentException("null example"); return new Example(entity, NOT_NULL_OR_EMPTY_STRING); } /// <summary> /// /// </summary> /// <param name="entity"></param> /// <param name="selector"></param> protected Example(object entity, PropertySelector selector) { this.entity = entity; this.selector = selector; } /// <summary> /// /// </summary> /// <returns></returns> public override String ToString() { return entity.ToString(); } private bool IsPropertyIncluded(object value, String name, IType type) { return !excludedProperties.Contains(name) && !type.IsAssociationType && selector.Include(value, name, type); } /// <summary> /// /// </summary> /// <param name="sessionFactory"></param> /// <param name="persistentClass"></param> /// <returns></returns> public override TypedValue[] GetTypedValues(ISessionFactoryImplementor sessionFactory, System.Type persistentClass) { return expressions.GetTypedValues(sessionFactory, persistentClass); } /// <summary> /// /// </summary> /// <param name="factory"></param> /// <param name="persistentClass"></param> /// <param name="alias"></param> /// <returns></returns> public override SqlString ToSqlString(ISessionFactoryImplementor factory, System.Type persistentClass, string alias) { IClassMetadata meta = factory.GetClassMetadata(persistentClass); String[] propertyNames = meta.PropertyNames; IType[] propertyTypes = meta.PropertyTypes; object[] propertyValues = meta.GetPropertyValues(entity); for (int i=0; i<propertyNames.Length; i++) { object propertyValue = propertyValues[i]; String propertyName = propertyNames[i]; // Have to figure out how to get the name or index of the version property bool isPropertyIncluded = i!=meta.VersionProperty && IsPropertyIncluded( propertyValue, propertyName, propertyTypes[i] ); if (isPropertyIncluded) { if ( propertyTypes[i].IsComponentType) { AppendComponentCondition( propertyName, propertyValue, (IAbstractComponentType) propertyTypes[i], persistentClass, alias, factory ); } else { AppendPropertyCondition( propertyName, propertyValue, persistentClass, alias, factory ); } } } return expressions.ToSqlString(factory, persistentClass, alias); } /// <summary> /// /// </summary> /// <param name="propertyName"></param> /// <param name="propertyValue"></param> /// <param name="persistentClass"></param> /// <param name="alias"></param> /// <param name="sessionFactory"></param> protected void AppendPropertyCondition( String propertyName, object propertyValue, System.Type persistentClass, String alias, ISessionFactoryImplementor sessionFactory) { Expression crit; if ( propertyValue!=null ) { bool isString = propertyValue is String; crit = ( isLikeEnabled && isString ) ? (Expression) new LikeExpression( propertyName, propertyValue) : (Expression) new EqExpression( propertyName, propertyValue ); } else { crit = new NullExpression(propertyName); } expressions.Add(crit); } /// <summary> /// /// </summary> /// <param name="path"></param> /// <param name="component"></param> /// <param name="type"></param> /// <param name="persistentClass"></param> /// <param name="alias"></param> /// <param name="sessionFactory"></param> protected void AppendComponentCondition( String path, object component, IAbstractComponentType type, System.Type persistentClass, String alias, ISessionFactoryImplementor sessionFactory) { if (component!=null) { String[] propertyNames = type.PropertyNames; object[] values = type.GetPropertyValues(component, null); IType[] subtypes = type.Subtypes; for (int i=0; i<propertyNames.Length; i++) { String subpath = StringHelper.Qualify( path, propertyNames[i] ); object value = values[i]; if ( IsPropertyIncluded( value, subpath, subtypes[i] ) ) { IType subtype = subtypes[i]; if ( subtype.IsComponentType ) { AppendComponentCondition( subpath, value, (IAbstractComponentType) subtype, persistentClass, alias, sessionFactory ); } else { AppendPropertyCondition( subpath, value, persistentClass, alias, sessionFactory ); } } } } } } } --- NEW FILE: MatchMode.cs --- using System; using System.Collections; namespace NHibernate.Expression { /// <summary> /// Represents an strategy for matching strings using "like". /// </summary> public abstract class MatchMode { private int intCode; private string name; private static Hashtable INSTANCES = new Hashtable(); /// <summary> /// /// </summary> /// <param name="intCode"></param> /// <param name="name"></param> protected MatchMode(int intCode, string name) { this.intCode = intCode; this.name = name; } /// <summary> /// /// </summary> /// <returns></returns> public override string ToString() { return name; } /// <summary> /// convert the pattern, by appending/prepending "%" /// </summary> public abstract string ToMatchString(string pattern); private Object ReadResolve() { return INSTANCES[intCode]; } static MatchMode() { INSTANCES.Add(EXACT.intCode, EXACT); INSTANCES.Add(START.intCode, START); INSTANCES.Add(END.intCode, END); INSTANCES.Add(ANYWHERE.intCode, ANYWHERE); } /// <summary> /// Match the entire string to the pattern /// </summary> public static readonly MatchMode EXACT = new ExactMatchMode(); /// <summary> /// Match the start of the string to the pattern /// </summary> public static readonly MatchMode START = new StartMatchMode(); /// <summary> /// Match the end of the string to the pattern /// </summary> public static readonly MatchMode END = new EndMatchMode(); /// <summary> /// Match the pattern anywhere in the string /// </summary> public static readonly MatchMode ANYWHERE = new AnywhereMatchMode(); private class ExactMatchMode : MatchMode { public ExactMatchMode():base(0, "EXACT") { } public override string ToMatchString(string pattern) { return pattern; } } private class StartMatchMode : MatchMode { public StartMatchMode() : base(1, "START") { } public override string ToMatchString(string pattern) { return '%' + pattern; } } private class EndMatchMode : MatchMode { public EndMatchMode() : base(2, "END") { } public override string ToMatchString(string pattern) { return pattern + '%'; } } private class AnywhereMatchMode : MatchMode { public AnywhereMatchMode() : base(3, "ANYWHERE") { } public override string ToMatchString(string pattern) { return '%' + pattern + '%'; } } } } |
From: Paul H. <pha...@us...> - 2005-03-28 12:46:11
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6075/nhibernate/src/NHibernate.Test Modified Files: NHibernate.Test-1.1.csproj Log Message: NH-112 - Query by Example Index: NHibernate.Test-1.1.csproj =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/NHibernate.Test-1.1.csproj,v retrieving revision 1.67 retrieving revision 1.68 diff -C2 -d -r1.67 -r1.68 *** NHibernate.Test-1.1.csproj 21 Mar 2005 12:11:46 -0000 1.67 --- NHibernate.Test-1.1.csproj 28 Mar 2005 12:45:57 -0000 1.68 *************** *** 330,333 **** --- 330,338 ---- /> <File + RelPath = "ExpressionTest\QueryByExampleTest.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "ExpressionTest\SimpleExpressionFixture.cs" SubType = "Code" |
From: Paul H. <pha...@us...> - 2005-03-28 12:43:46
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Type In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4953/nhibernate/src/NHibernate/Type Added Files: EnumType.cs Log Message: NH-66 : Need new Persistent Enum Type underlying using string store, not tested! --- NEW FILE: EnumType.cs --- using System; using System.Collections; using System.Data; using NHibernate.Engine; using NHibernate.SqlTypes; namespace NHibernate.Type { /// <summary> /// Persistent EnumType underlying using string store. /// </summary> public class EnumType : ImmutableType, IDiscriminatorType { private readonly System.Type enumClass; /// <summary></summary> public const int MaxLengthForEnumString = 100; /// <summary> /// /// </summary> /// <param name="enumClass"></param> public EnumType(System.Type enumClass) : base(SqlTypeFactory.GetStringFixedLength(MaxLengthForEnumString)) { if(enumClass.IsEnum) this.enumClass = enumClass; else throw new MappingException(enumClass.Name + " did not inherit from System.Enum" ); } /// <summary> /// /// </summary> /// <param name="code"></param> /// <returns></returns> public virtual object GetInstance(object code) { //code is an named constants defined for the enumeration. try { return Enum.Parse(enumClass, code as string, true); } catch (ArgumentException ae) { throw new HibernateException( string.Format( "Can't Parse {0} as {1}", code, enumClass.Name), ae ); } } /// <summary> /// /// </summary> /// <param name="code"></param> /// <returns></returns> public virtual object GetValue(object code) { //code is an enum instance. return code == null ? string.Empty : code.ToString(); } /// <summary> /// /// </summary> /// <param name="x"></param> /// <param name="y"></param> /// <returns></returns> public override bool Equals(object x, object y) { //return (x==y) || ( x!=null && y!=null && x.GetType()==y.GetType() && x.ToString()==y.ToString() ); return (x==y) || ( x!=null && y!=null && x.Equals(y) ) ; } /// <summary> /// /// </summary> public override System.Type ReturnedClass { get { return enumClass; } } /// <summary> /// /// </summary> /// <param name="cmd"></param> /// <param name="value"></param> /// <param name="index"></param> public override void Set(IDbCommand cmd, object value, int index) { IDataParameter par = (IDataParameter) cmd.Parameters[index]; if (value == null) { par.Value = DBNull.Value; } else { par.Value = value; } } /// <summary> /// /// </summary> /// <param name="rs"></param> /// <param name="index"></param> /// <returns></returns> public override object Get(IDataReader rs, int index) { object code = rs[index]; if ( code == DBNull.Value || code==null) { return null; } else { return GetInstance(code); } } /// <summary> /// /// </summary> /// <param name="rs"></param> /// <param name="name"></param> /// <returns></returns> public override object Get(IDataReader rs, string name) { return Get(rs, rs.GetOrdinal(name)); } /// <summary> /// /// </summary> public override string Name { get { return enumClass.Name; } } /// <summary> /// /// </summary> /// <param name="value"></param> /// <returns></returns> public override string ToXML(object value) { return (value==null) ? null : GetValue(value).ToString(); } /// <summary> /// /// </summary> /// <param name="cached"></param> /// <param name="session"></param> /// <param name="owner"></param> /// <returns></returns> public override object Assemble(object cached, ISessionImplementor session, object owner) { if (cached==null) { return null; } else { return GetInstance(cached); } } /// <summary> /// /// </summary> /// <param name="value"></param> /// <param name="session"></param> /// <returns></returns> public override object Disassemble(object value, ISessionImplementor session) { return (value==null) ? null : GetValue(value); } /// <summary> /// /// </summary> /// <param name="value"></param> /// <returns></returns> public string ObjectToSQLString(object value) { return GetValue(value).ToString(); } /// <summary> /// /// </summary> /// <param name="xml"></param> /// <returns></returns> public object StringToObject( string xml ) { return GetInstance( xml ); } } } |
From: Paul H. <pha...@us...> - 2005-03-28 10:24:54
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25896/nhibernate/src/NHibernate.Test Modified Files: MasterDetailTest.cs Log Message: Additional tests as per 2.1 test suite - mainly stubs for now Index: MasterDetailTest.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/MasterDetailTest.cs,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** MasterDetailTest.cs 17 Jan 2005 03:40:51 -0000 1.18 --- MasterDetailTest.cs 28 Mar 2005 10:24:44 -0000 1.19 *************** *** 17,32 **** public void SetUp() { - ExportSchema(new string[] { ! "MasterDetail.hbm.xml", ! "Custom.hbm.xml", ! "Category.hbm.xml", ! "INameable.hbm.xml", ! "SingleSeveral.hbm.xml", ! "WZ.hbm.xml" }, true); } [Test] public void SelfManyToOne() { --- 17,73 ---- public void SetUp() { ExportSchema(new string[] { ! "MasterDetail.hbm.xml", ! "Custom.hbm.xml", ! "Category.hbm.xml", ! "INameable.hbm.xml", ! "SingleSeveral.hbm.xml", ! "WZ.hbm.xml", ! "UpDown.hbm.xml", ! "Eye.hbm.xml", ! "MN.hbm.xml" }, true); } [Test] + [Ignore( "Test not written" )] + public void ParentChildren() + { + ISession s = sessions.OpenSession(); + + //M parent = new M + } + + [Test] + [Ignore( "Test not written" )] + public void OuterJoin() + { + } + + [Test] + [Ignore( "Test not written" )] + public void Meta() + { + } + + [Test] + [Ignore( "Test not written" )] + public void Copy() + { + } + + [Test] + [Ignore( "Test not written" )] + public void CopyCascade() + { + } + + [Test] + [Ignore( "Test not written" )] + public void NotNullDiscriminator() + { + } + + [Test] public void SelfManyToOne() { *************** *** 53,56 **** --- 94,103 ---- [Test] + [Ignore( "Test not written" )] + public void Example() + { + } + + [Test] public void NonLazyBidrectional() { *************** *** 568,571 **** --- 615,624 ---- [Test] + [Ignore( "Test not written" )] + public void CollectionReplaceOnUpdate() + { + } + + [Test] public void CollectionReplace2() { *************** *** 722,725 **** --- 775,784 ---- [Test] + [Ignore( "Test not written" )] + public void CachedCollectionRefresh() + { + } + + [Test] public void CustomPersister() { *************** *** 797,800 **** --- 856,871 ---- s.Close(); } + + [Test] + [Ignore( "Test not written" )] + public void QueuedBagAdds() + { + } + + [Test] + [Ignore( "Test not written" )] + public void PolymorphicCriteria() + { + } } } |
From: Paul H. <pha...@us...> - 2005-03-28 10:24:03
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Persister In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25292/nhibernate/src/NHibernate/Persister Modified Files: AbstractEntityPersister.cs EntityPersister.cs IQueryable.cs NormalizedEntityPersister.cs Log Message: Implements Null/Not Null discriminator, allows for a default subclass without an explicit value Index: NormalizedEntityPersister.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Persister/NormalizedEntityPersister.cs,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** NormalizedEntityPersister.cs 26 Mar 2005 15:36:40 -0000 1.42 --- NormalizedEntityPersister.cs 28 Mar 2005 10:23:53 -0000 1.43 *************** *** 644,647 **** --- 644,648 ---- } + /* /// <summary></summary> public override string DiscriminatorSQLString *************** *** 649,652 **** --- 650,654 ---- get { return discriminatorSQLString; } } + */ /// <summary></summary> Index: AbstractEntityPersister.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Persister/AbstractEntityPersister.cs,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** AbstractEntityPersister.cs 26 Mar 2005 13:24:37 -0000 1.36 --- AbstractEntityPersister.cs 28 Mar 2005 10:23:53 -0000 1.37 *************** *** 1334,1339 **** uniqueKeyType = factory.GetPersister( clazz ).IdentifierType; } - // TODO: 2.1 - Change EntityLoader to handle this - //uniqueKeyLoaders.Add( propertyNames[ i ], new EntityLoader( this, columns, uniqueKeyType, factory ) ); uniqueKeyLoaders.Add( propertyNames[ i ], new EntityLoader( this, columns, uniqueKeyType, 1, factory ) ); } --- 1334,1337 ---- *************** *** 1351,1357 **** /// <summary></summary> - public abstract string DiscriminatorSQLString { get; } - - /// <summary></summary> /// <remarks>This is the 2.1 version, DiscriminatorSQLString will be redunant shortly</remarks> public abstract object DiscriminatorSQLValue{ get; } --- 1349,1352 ---- Index: EntityPersister.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Persister/EntityPersister.cs,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** EntityPersister.cs 26 Mar 2005 13:24:37 -0000 1.39 --- EntityPersister.cs 28 Mar 2005 10:23:53 -0000 1.40 *************** *** 65,69 **** private readonly string discriminatorColumnName; private readonly IDiscriminatorType discriminatorType; - private readonly string discriminatorSQLString; private readonly string discriminatorAlias; private readonly object discriminatorSQLValue; --- 65,68 ---- *************** *** 95,161 **** // detect mapping errors HashedSet distinctColumns = new HashedSet(); - - // DISCRIMINATOR - object discriminatorValue; - if( model.IsPolymorphic ) - { - IValue d = model.Discriminator; - if( d == null ) - { - throw new MappingException( "discriminator mapping required for polymorphic persistence" ); - } - forceDiscriminator = model.IsForceDiscriminator; - - // the discriminator will have only one column - foreach( Column discColumn in d.ColumnCollection ) - { - discriminatorColumnName = discColumn.GetQuotedName( Dialect ); - discriminatorAlias = discColumn.Alias( Dialect ); - } - - try - { - discriminatorType = ( IDiscriminatorType ) model.Discriminator.Type; - if( "null".Equals( model.DiscriminatorValue ) ) - { - discriminatorValue = null; - discriminatorSQLString = "null"; - discriminatorInsertable = false; - } - else - { - discriminatorValue = discriminatorType.StringToObject( model.DiscriminatorValue ); - discriminatorSQLString = discriminatorType.ObjectToSQLString( discriminatorValue ); - } - discriminatorSQLValue = discriminatorSQLString; - } - // TODO: add a ClassCastException here to catch illegal disc types - catch( Exception e ) - { - string msg = String.Format( "Could not format discriminator value '{0}' to sql string using the IType {1}", - model.DiscriminatorValue, - model.Discriminator.Type.ToString() ); - - throw new MappingException( msg , e ); - } - - distinctColumns.Add( discriminatorColumnName ); - } - else - { - forceDiscriminator = false; - discriminatorColumnName = null; - discriminatorInsertable = false; - discriminatorValue = null; - discriminatorType = null; - discriminatorSQLString = null; - } // DISCRIMINATOR - /* object discriminatorValue; if( model.IsPolymorphic ) { ! Value d = model.Discriminator; if( d == null ) { --- 94,103 ---- // detect mapping errors HashedSet distinctColumns = new HashedSet(); // DISCRIMINATOR object discriminatorValue; if( model.IsPolymorphic ) { ! IValue d = model.Discriminator; if( d == null ) { *************** *** 223,227 **** discriminatorSQLValue = null; } - */ // PROPERTIES --- 165,168 ---- *************** *** 365,371 **** { subclassClosure[ k++ ] = sc.MappedClass; ! if( "null".Equals( sc.DiscriminatorValue ) ) { ! subclassesByDiscriminatorValue.Add( ObjectUtils.Null, sc.MappedClass ); } else --- 306,316 ---- { subclassClosure[ k++ ] = sc.MappedClass; ! if( sc.IsDiscriminatorValueNull ) { ! subclassesByDiscriminatorValue.Add( NullDiscriminator, sc.MappedClass ); ! } ! else if( sc.IsDiscriminatorValueNotNull ) ! { ! subclassesByDiscriminatorValue.Add( NotNullDiscriminator, sc.MappedClass ); } else *************** *** 377,380 **** --- 322,329 ---- sc.MappedClass ); } + catch( InvalidCastException ) + { + throw new MappingException( string.Format( "Illegal discriminator type: {0}", discriminatorType.Name ) ); + } catch( Exception e ) { *************** *** 533,544 **** /// <summary></summary> - public override string DiscriminatorSQLString - { - // HACK: This will /fail when we use null/not null discriminators - //get { return (string) DiscriminatorSQLValue; } - get { return discriminatorSQLString; } - } - - /// <summary></summary> public override object DiscriminatorSQLValue { --- 482,485 ---- *************** *** 561,569 **** if( value == null ) { ! return ( System.Type ) subclassesByDiscriminatorValue[ ObjectUtils.Null ]; } else { ! return ( System.Type ) subclassesByDiscriminatorValue[ value ]; } } --- 502,515 ---- if( value == null ) { ! return ( System.Type ) subclassesByDiscriminatorValue[ NullDiscriminator ]; } else { ! System.Type result = ( System.Type ) subclassesByDiscriminatorValue[ value ]; ! if ( result == null ) ! { ! result = ( System.Type ) subclassesByDiscriminatorValue[ NotNullDiscriminator ]; ! } ! return result; } } *************** *** 653,659 **** } ! if( IsPolymorphic ) { ! builder.AddColumn( DiscriminatorColumnName, DiscriminatorSQLString ); } --- 599,605 ---- } ! if( discriminatorInsertable ) { ! builder.AddColumn( DiscriminatorColumnName, DiscriminatorSQLValue.ToString() ); } *************** *** 1349,1353 **** { frag.AddValue( ! ( ( IQueryable ) factory.GetPersister( subclasses[ i ] ) ).DiscriminatorSQLString ); } --- 1295,1299 ---- { frag.AddValue( ! ( ( IQueryable ) factory.GetPersister( subclasses[ i ] ) ).DiscriminatorSQLValue ); } Index: IQueryable.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Persister/IQueryable.cs,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** IQueryable.cs 14 Mar 2005 18:53:15 -0000 1.11 --- IQueryable.cs 28 Mar 2005 10:23:53 -0000 1.12 *************** *** 24,27 **** --- 24,28 ---- System.Type MappedSuperclass { get; } + /* /// <summary> /// The discriminator value for this particular concrete subclass, as a string that may be *************** *** 29,32 **** --- 30,40 ---- /// </summary> string DiscriminatorSQLString { get; } + */ + + /// <summary> + /// The discriminator value for this particular concrete subclass, as a string that may be + /// embedded in a select statement + /// </summary> + object DiscriminatorSQLValue { get; } /// <summary> |
From: Paul H. <pha...@us...> - 2005-03-28 10:24:02
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/SqlCommand In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25292/nhibernate/src/NHibernate/SqlCommand Modified Files: InFragment.cs Log Message: Implements Null/Not Null discriminator, allows for a default subclass without an explicit value Index: InFragment.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/SqlCommand/InFragment.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** InFragment.cs 1 Mar 2005 16:24:50 -0000 1.4 --- InFragment.cs 28 Mar 2005 10:23:54 -0000 1.5 *************** *** 23,27 **** /// <param name="value"></param> /// <returns></returns> ! public InFragment AddValue( string value ) { values.Add( value ); --- 23,27 ---- /// <param name="value"></param> /// <returns></returns> ! public InFragment AddValue( object value ) { values.Add( value ); *************** *** 55,59 **** public SqlString ToFragmentString() { ! SqlStringBuilder buf = new SqlStringBuilder( values.Count*5 ); buf.Add( columnName ); --- 55,59 ---- public SqlString ToFragmentString() { ! SqlStringBuilder buf = new SqlStringBuilder( values.Count * 5 ); buf.Add( columnName ); *************** *** 71,79 **** for( int i = 0; i < values.Count; i++ ) { ! if( "null".Equals( values[ i ] ) || Null.Equals( values[ i ] ) ) { allowNull = true; } ! else if ( "not null".Equals( values[ i ] ) || NotNull.Equals( values[ i ] ) ) { throw new ArgumentOutOfRangeException( "not null makes no sense for in expression" ) ; --- 71,79 ---- for( int i = 0; i < values.Count; i++ ) { ! if( Null.Equals( values[ i ] ) ) { allowNull = true; } ! else if ( NotNull.Equals( values[ i ] ) ) { throw new ArgumentOutOfRangeException( "not null makes no sense for in expression" ) ; *************** *** 108,115 **** { string value = values[ 0 ] as string; ! if( "null".Equals( value ) ) { buf.Add( " is null" ); } else { --- 108,119 ---- { string value = values[ 0 ] as string; ! if( Null.Equals( value ) ) { buf.Add( " is null" ); } + else if ( NotNull.Equals( value ) ) + { + buf.Add( " is not null " ); + } else { |
From: Paul H. <pha...@us...> - 2005-03-28 10:24:01
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Loader In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25292/nhibernate/src/NHibernate/Loader Modified Files: EntityLoader.cs Log Message: Implements Null/Not Null discriminator, allows for a default subclass without an explicit value Index: EntityLoader.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Loader/EntityLoader.cs,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** EntityLoader.cs 14 Mar 2005 18:53:03 -0000 1.10 --- EntityLoader.cs 28 Mar 2005 10:23:53 -0000 1.11 *************** *** 12,16 **** /// </summary> /// <remarks> ! /// The <tt>ClassPersister</tt> must implement <tt>Loadable</tt>. For other entities, /// create a customized subclass of <tt>Loader</tt>. /// </remarks> --- 12,16 ---- /// </summary> /// <remarks> ! /// The <tt>ClassPersister</tt> must implement <tt>ILoadable</tt>. For other entities, /// create a customized subclass of <tt>Loader</tt>. /// </remarks> |
From: Paul H. <pha...@us...> - 2005-03-28 10:24:01
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Hql In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25292/nhibernate/src/NHibernate/Hql Modified Files: WhereParser.cs Log Message: Implements Null/Not Null discriminator, allows for a default subclass without an explicit value Index: WhereParser.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Hql/WhereParser.cs,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** WhereParser.cs 14 Mar 2005 18:52:35 -0000 1.30 --- WhereParser.cs 28 Mar 2005 10:23:52 -0000 1.31 *************** *** 462,467 **** if( persister != null ) // the name of a class { ! // TODO: 2.1 - Use DiscriminatorSQLValue and compare to null/not null rather than DiscriminatorSQLString ! AppendToken( q, persister.DiscriminatorSQLString ); } else --- 462,471 ---- if( persister != null ) // the name of a class { ! object discrim = persister.DiscriminatorSQLValue; ! if ( InFragment.Null == discrim || InFragment.NotNull == discrim ) ! { ! throw new QueryException( "subclass test not allowed for null or not null discriminator" ); ! } ! AppendToken( q, discrim.ToString() ); } else |
From: Paul H. <pha...@us...> - 2005-03-28 10:19:47
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22986/nhibernate/src/NHibernate/Impl Modified Files: SessionImpl.cs Log Message: Implements SaveOrUpdateCopy - not tested! Index: SessionImpl.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl/SessionImpl.cs,v retrieving revision 1.77 retrieving revision 1.78 diff -C2 -d -r1.77 -r1.78 *** SessionImpl.cs 27 Mar 2005 23:30:27 -0000 1.77 --- SessionImpl.cs 28 Mar 2005 10:19:39 -0000 1.78 *************** *** 5437,5441 **** public object DoCopy( object obj, object id, IDictionary copiedAlready ) { - /* if ( obj == null ) { --- 5437,5440 ---- *************** *** 5443,5458 **** } ! if ( obj is IHibenateProxy ) { ! ILazyInitializer li = HibernateProxyHelper. } ! if ( copiedAlready.Contains( obj ) { return obj; // EARLY EXIT! } - */ ! return null; } } --- 5442,5527 ---- } ! if ( obj is INHibernateProxy ) { ! LazyInitializer li = NHibernateProxyHelper.GetLazyInitializer( (INHibernateProxy) obj ); ! if ( li.IsUninitialized ) ! { ! return Load( li.PersistentClass, li.Identifier ); // EARLY EXIT! ! } } ! if ( copiedAlready.Contains( obj ) ) { return obj; // EARLY EXIT! } ! EntityEntry entry = GetEntry( obj ); ! if ( entry != null ) ! { ! if ( id != null && entry.Id.Equals( id ) ) ! { ! return obj; //EARLY EXIT! ! } ! // else copy from one persistent instance to another! ! } ! ! System.Type clazz = obj.GetType() ; ! IClassPersister persister = GetPersister( clazz ); ! ! object result; ! object target; ! if ( id == null && persister.IsUnsaved( obj ) ) ! { ! copiedAlready[ obj ] = obj; ! SaveWithGeneratedIdentifier( obj, Cascades.CascadingAction.ActionCopy, copiedAlready ); ! result = obj; // TODO: Handle it's proxy (reassociate it, I suppose) ! target = obj; ! } ! else ! { ! if ( id == null ) ! { ! id = persister.GetIdentifier( obj ); ! } ! result = Get( clazz, id ); ! if ( result == null ) ! { ! copiedAlready[ obj ] = obj; ! SaveWithGeneratedIdentifier( obj, Cascades.CascadingAction.ActionCopy, copiedAlready ); ! result = obj; // TODO: Could it have a proxy? ! target = obj; ! } ! else ! { ! target = Unproxy( result ); ! copiedAlready[ obj ] = target; ! if ( target == obj ) ! { ! return result; ! } ! else if ( NHibernateUtil.GetClass( result ) != clazz ) ! { ! throw new WrongClassException( "class of the given object did not match class of persistent copy", id, clazz ); ! } ! else if ( persister.IsVersioned && !persister.VersionType.Equals( persister.GetVersion( result ), persister.GetVersion( obj ) ) ) ! { ! throw new StaleObjectStateException( clazz, id ); ! } ! ! // cascade first, so that all unsaved objected get saved before we actually copy ! Cascades.Cascade( this, persister, obj, Cascades.CascadingAction.ActionCopy, Engine.CascadePoint.CascadeOnCopy, copiedAlready ); ! } ! } ! ! // no need to handle the version differently ! object[] copiedValues = TypeFactory.Copy( ! persister.GetPropertyValues( obj ), ! persister.GetPropertyValues( target ), ! persister.PropertyTypes, ! this, ! target, copiedAlready ); ! ! persister.SetPropertyValues( target, copiedValues ); ! return result; } } |
From: Paul H. <pha...@us...> - 2005-03-28 10:18:46
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Type In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22679/nhibernate/src/NHibernate/Type Modified Files: TypeFactory.cs Log Message: Implements the Copy function required for SaveOrUpdateCopy Index: TypeFactory.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Type/TypeFactory.cs,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** TypeFactory.cs 14 Mar 2005 18:54:20 -0000 1.46 --- TypeFactory.cs 28 Mar 2005 10:18:37 -0000 1.47 *************** *** 1135,1138 **** --- 1135,1158 ---- } } + + /// <summary> + /// + /// </summary> + /// <param name="original"></param> + /// <param name="target"></param> + /// <param name="types"></param> + /// <param name="session"></param> + /// <param name="owner"></param> + /// <param name="copiedAlready"></param> + /// <returns></returns> + public static object[] Copy( object[] original, object[] target, IType[] types, ISessionImplementor session, object owner, IDictionary copiedAlready ) + { + object[] copied = new object[ original.Length ]; + for ( int i = 0; i < original.Length; i++ ) + { + copied[ i ] = types[ i ].Copy( original[ i ], target[ i ], session, owner, copiedAlready ); + } + return copied; + } } } \ No newline at end of file |
From: Paul H. <pha...@us...> - 2005-03-28 10:17:53
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Type In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22436/nhibernate/src/NHibernate/Type Modified Files: Int64Type.cs Log Message: Allow Int64 to be a discriminator Index: Int64Type.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Type/Int64Type.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Int64Type.cs 31 Dec 2004 23:53:39 -0000 1.8 --- Int64Type.cs 28 Mar 2005 10:17:45 -0000 1.9 *************** *** 9,13 **** /// to a <see cref="DbType.Int64"/> column. /// </summary> ! public class Int64Type : ValueTypeType, IIdentifierType, IVersionType { /// <summary></summary> --- 9,13 ---- /// to a <see cref="DbType.Int64"/> column. /// </summary> ! public class Int64Type : ValueTypeType, IDiscriminatorType, IVersionType { /// <summary></summary> |
From: Paul H. <pha...@us...> - 2005-03-28 10:16:28
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.DomainModel In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21393/nhibernate/src/NHibernate.DomainModel Modified Files: NHibernate.DomainModel-1.1.csproj Added Files: ABCExtends.hbm.xml AltSimple.hbm.xml Broken.hbm.xml Down.cs Eye.cs Eye.hbm.xml Jay.cs M.cs MN.hbm.xml MultiExtends.hbm.xml N.cs Up.cs UpDown.hbm.xml Log Message: Mapping files/classes required for some 2.1 tests --- NEW FILE: Eye.cs --- using System; using Iesi.Collections; namespace NHibernate.DomainModel { /// <summary> /// Summary description for Eye. /// </summary> public class Eye { private long id; private string name; private Jay jay; private ISet jays = new HashedSet(); public Eye() { } public long Id { get { return id; } set { id = value; } } public string Name { get { return name; } set { name = value; } } public Jay Jay { get { return jay; } set { jay = value; } } public ISet Jays { get { return jays; } set { jays = value; } } } } Index: NHibernate.DomainModel-1.1.csproj =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.DomainModel/NHibernate.DomainModel-1.1.csproj,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** NHibernate.DomainModel-1.1.csproj 26 Mar 2005 13:24:35 -0000 1.32 --- NHibernate.DomainModel-1.1.csproj 28 Mar 2005 10:16:20 -0000 1.33 *************** *** 104,107 **** --- 104,111 ---- /> <File + RelPath = "ABCExtends.hbm.xml" + BuildAction = "EmbeddedResource" + /> + <File RelPath = "ABCProxy.hbm.xml" BuildAction = "EmbeddedResource" *************** *** 118,121 **** --- 122,129 ---- /> <File + RelPath = "AltSimple.hbm.xml" + BuildAction = "EmbeddedResource" + /> + <File RelPath = "AssemblyInfo.cs" SubType = "Code" *************** *** 166,169 **** --- 174,181 ---- /> <File + RelPath = "Broken.hbm.xml" + BuildAction = "EmbeddedResource" + /> + <File RelPath = "C1.cs" SubType = "Code" *************** *** 185,188 **** --- 197,205 ---- /> <File + RelPath = "Child.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "Circular.cs" SubType = "Code" *************** *** 261,264 **** --- 278,286 ---- /> <File + RelPath = "Down.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "E.cs" SubType = "Code" *************** *** 266,269 **** --- 288,300 ---- /> <File + RelPath = "Eye.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "Eye.hbm.xml" + BuildAction = "EmbeddedResource" + /> + <File RelPath = "Fee.cs" SubType = "Code" *************** *** 354,362 **** /> <File - RelPath = "Child.cs" - SubType = "Code" - BuildAction = "Compile" - /> - <File RelPath = "Immutable.cs" SubType = "Code" --- 385,388 ---- *************** *** 392,395 **** --- 418,426 ---- /> <File + RelPath = "Jay.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "LessSimple.cs" SubType = "Code" *************** *** 406,409 **** --- 437,445 ---- /> <File + RelPath = "M.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "Many.cs" SubType = "Code" *************** *** 438,441 **** --- 474,481 ---- /> <File + RelPath = "MN.hbm.xml" + BuildAction = "EmbeddedResource" + /> + <File RelPath = "Mono.cs" SubType = "Code" *************** *** 457,460 **** --- 497,504 ---- /> <File + RelPath = "MultiExtends.hbm.xml" + BuildAction = "EmbeddedResource" + /> + <File RelPath = "Multiplicity.cs" SubType = "Code" *************** *** 467,470 **** --- 511,519 ---- /> <File + RelPath = "N.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "NestingComponent.cs" SubType = "Code" *************** *** 600,603 **** --- 649,661 ---- /> <File + RelPath = "Up.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "UpDown.hbm.xml" + BuildAction = "EmbeddedResource" + /> + <File RelPath = "Vetoer.cs" SubType = "Code" *************** *** 678,696 **** /> <File ! RelPath = "NHSpecific\ClassWithNullColumns.cs" SubType = "Code" BuildAction = "Compile" /> <File ! RelPath = "NHSpecific\ClassWithNullColumns.hbm.xml" BuildAction = "EmbeddedResource" /> <File ! RelPath = "NHSpecific\Child.cs" SubType = "Code" BuildAction = "Compile" /> <File ! RelPath = "NHSpecific\Child.hbm.xml" BuildAction = "EmbeddedResource" /> --- 736,754 ---- /> <File ! RelPath = "NHSpecific\Child.cs" SubType = "Code" BuildAction = "Compile" /> <File ! RelPath = "NHSpecific\Child.hbm.xml" BuildAction = "EmbeddedResource" /> <File ! RelPath = "NHSpecific\ClassWithNullColumns.cs" SubType = "Code" BuildAction = "Compile" /> <File ! RelPath = "NHSpecific\ClassWithNullColumns.hbm.xml" BuildAction = "EmbeddedResource" /> --- NEW FILE: MultiExtends.hbm.xml --- <?xml version="1.0"?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.0"> <joined-subclass name="org.hibernate.test.Mono" extends="org.hibernate.test.Top" table="mono" dynamic-insert="true" dynamic-update="true"> <key column="superid"/> <set name="strings" table="monostrings"> <key column="monoid_"/> <element type="string" column="str_"/> </set> </joined-subclass> </hibernate-mapping> --- NEW FILE: Up.cs --- using System; namespace NHibernate.DomainModel { /// <summary> /// Summary description for Up. /// </summary> public class Up { private string id1; private long id2; public Up() { // // TODO: Add constructor logic here // } public string Id1 { get { return id1; } set { id1 = value; } } public long Id2 { get { return id2; } set { id2 = value; } } public int GetHashcode() { return id1.GetHashCode(); } } } --- NEW FILE: AltSimple.hbm.xml --- <?xml version="1.0"?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.0"> <class name="org.hibernate.test.Simple" table="SIMP"> <id type="long" column="id_"> <generator class="assigned"/> </id> <property name="name"/> <property name="address"/> <property name="count" column="count_" not-null="true" unique="true"/> <property name="date" column="date_"/> <property name="pay"/> <many-to-one name="other"/> </class> </hibernate-mapping> --- NEW FILE: Down.cs --- using System; namespace NHibernate.DomainModel { /// <summary> /// Summary description for Down. /// </summary> public class Down : Up { private long val; public Down() { // // TODO: Add constructor logic here // } public long Value { get { return val; } set { val = value; } } } } --- NEW FILE: Eye.hbm.xml --- <?xml version="1.0"?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.0" default-cascade="save-update" namespace="NHibernate.DomainModel" assembly="NHibernate.DomainModel" default-access="field.camelcase"> <class name="Eye" lazy="true"> <id name="id" unsaved-value="0"> <generator class="hilo"/> </id> <property name="name"/> <set name="jays" inverse="true" outer-join="true" cascade="all"> <key column="eye"/> <one-to-many class="Jay"/> </set> <many-to-one name="jay" outer-join="true"/> </class> <class name="Jay" lazy="true"> <id name="id" unsaved-value="0"> <generator class="hilo"/> </id> <many-to-one name="eye" outer-join="true"/> </class> </hibernate-mapping> --- NEW FILE: UpDown.hbm.xml --- <?xml version="1.0" encoding="UTF-8"?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.0" assembly="NHibernate.DomainModel" default-access="property"> <class name="NHibernate.DomainModel.Up" discriminator-value="null"> <composite-id> <key-property name="Id1"/> <key-property name="Id2"/> </composite-id> <discriminator column="value_" type="long" not-null="false"/> <subclass name="NHibernate.DomainModel.Down" discriminator-value="not null"> <property name="Value" column="value_" type="long"/> </subclass> </class> </hibernate-mapping> --- NEW FILE: ABCExtends.hbm.xml --- <?xml version="1.0"?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.0" namespace="NHibernate.DomainModel" assembly="NHibernate.DomainModel" > <subclass name="C2" discriminator-value="2" extends="B"> <property name="address" column="c2"/> </subclass> </hibernate-mapping> --- NEW FILE: Broken.hbm.xml --- <?xml version="1.0"?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.0"> <class name="org.hibernate.test.Broken" table="BROKE"> <!--id name="id" type="long" column="id_"> <generator class="hilo"/> </id--> <composite-id> <key-property name="id"/> <key-property name="otherId"/> </composite-id> <timestamp name="timestamp" column="`timestamp`"/> <joined-subclass name="org.hibernate.test.Fixed" table="FIX"> <key> <column name="BROKE_ID"/> <column name="OTHER_BROKE_ID"/> </key> <set name="set" lazy="true" inverse="true"> <key> <column name="FIX_ID"/> <column name="OTHER_FIX_ID"/> </key> <one-to-many class="org.hibernate.test.Broken"/> </set> <property name="list" type="serializable"/> </joined-subclass> </class> </hibernate-mapping> --- NEW FILE: N.cs --- using System; namespace NHibernate.DomainModel { /// <summary> /// Summary description for N. /// </summary> public class N { private long uniqueSequence; private M parent; private string str; public N() { // // TODO: Add constructor logic here // } public long UniqueSequence { get { return uniqueSequence; } set { uniqueSequence = value; } } public M Parent { get { return parent; } set { parent = value; } } public string String { get { return str; } set { str = value; } } public override int GetHashCode() { return str.GetHashCode(); } } } --- NEW FILE: M.cs --- using System; using Iesi.Collections; namespace NHibernate.DomainModel { /// <summary> /// Summary description for M. /// </summary> public class M { private long uniqueSequence; protected ISet children; public M() { children = new HashedSet(); } public long UniqueSequence { get { return uniqueSequence; } set { uniqueSequence = value; } } public ISet Children { get { return children; } set { children = value; } } public void AddChildren( N pChildren ) { pChildren.Parent = this; children.Add( pChildren ); } public void RemoveChildren( N pChildren ) { if ( children.Contains( pChildren ) ) { children.Remove( pChildren ); } } } } --- NEW FILE: Jay.cs --- using System; namespace NHibernate.DomainModel { /// <summary> /// Summary description for Jay. /// </summary> public class Jay { private long id; private Eye eye; public Jay() { } public Jay( Eye eye ) { eye.Jays.Add( this ); this.eye = eye; } public long Id { get { return id; } set { id = value; } } public Eye Eye { get { return eye; } set { eye = value; } } } } --- NEW FILE: MN.hbm.xml --- <?xml version="1.0"?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.0" namespace="NHibernate.DomainModel" assembly="NHibernate.DomainModel" default-access="property"> <class name="M" table="M"> <id name="UniqueSequence" column="uniqueSequence" type="long" unsaved-value="null"> <generator class="native"> </generator> </id> <set name="Children" lazy="false" inverse="true" cascade="all-delete-orphan"> <key column="fkParent"/> <one-to-many class="N"/> </set> </class> <class name="N" table="N"> <id name="UniqueSequence" column="uniqueSequence" type="long" unsaved-value="null"> <generator class="native"> </generator> </id> <property name="String" type="string" column="String"/> <many-to-one name="Parent" column="fkParent" not-null="true"/> </class> </hibernate-mapping> |
From: Paul H. <pha...@us...> - 2005-03-28 10:15:00
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Cfg In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20868/nhibernate/src/NHibernate/Cfg Modified Files: Binder.cs Log Message: NH-180 - More cases when default namespace/assembly can be used Implemented lazy proxies as per 2.1 Index: Binder.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Cfg/Binder.cs,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** Binder.cs 26 Mar 2005 13:24:36 -0000 1.43 --- Binder.cs 28 Mar 2005 10:14:52 -0000 1.44 *************** *** 85,89 **** //PROXY INTERFACE XmlAttribute proxyNode = node.Attributes["proxy"]; ! if (proxyNode!=null) { try --- 85,91 ---- //PROXY INTERFACE XmlAttribute proxyNode = node.Attributes["proxy"]; ! XmlAttribute lazyNode = node.Attributes["lazy"]; ! bool lazyTrue = lazyNode != null && "true".Equals( lazyNode.Value ); ! if ( proxyNode != null && ( lazyNode == null || lazyTrue ) ) { try *************** *** 96,99 **** --- 98,105 ---- } } + if ( proxyNode == null && lazyTrue ) + { + model.ProxyInterface = model.MappedClass; + } //DISCRIMINATOR *************** *** 706,710 **** try { ! model.Type = TypeFactory.ManyToOne( ReflectHelper.ClassForName( typeNode.Value ), model.ReferencedPropertyName ); } catch --- 712,717 ---- try { ! string name = FullClassName( typeNode.Value, mappings ); ! model.Type = TypeFactory.ManyToOne( ReflectHelper.ClassForName( name ), model.ReferencedPropertyName ); } catch *************** *** 766,770 **** try { ! model.Type = TypeFactory.OneToOne( ReflectHelper.ClassForName( classNode.Value ), model.ForeignKeyType, model.ReferencedPropertyName ) ; } catch (Exception) --- 773,778 ---- try { ! string name = FullClassName( classNode.Value, mappings ); ! model.Type = TypeFactory.OneToOne( ReflectHelper.ClassForName( name ), model.ForeignKeyType, model.ReferencedPropertyName ) ; } catch (Exception) *************** *** 779,784 **** try { ! model.Type = (EntityType) NHibernateUtil.Entity( ! ReflectHelper.ClassForName( node.Attributes["class"].Value) ); } catch (Exception e) --- 787,792 ---- try { ! string name = FullClassName( node.Attributes["class"].Value, mappings ); ! model.Type = (EntityType) NHibernateUtil.Entity( ReflectHelper.ClassForName( name ) ); } catch (Exception e) *************** *** 849,854 **** try { ! ! model.ElementClass = ReflectHelper.ClassForName( subnode.Attributes["class"].Value); } catch (Exception e) --- 857,862 ---- try { ! string className = FullClassName( subnode.Attributes["class"].Value, mappings ); ! model.ElementClass = ReflectHelper.ClassForName( className ); } catch (Exception e) *************** *** 1410,1414 **** try { ! clazz = ReflectHelper.ClassForName( returns.Attributes["class"].Value ); } catch (Exception) --- 1418,1423 ---- try { ! string name = FullClassName( returns.Attributes["class"].Value, model ); ! clazz = ReflectHelper.ClassForName( name ); } catch (Exception) |
From: Paul H. <pha...@us...> - 2005-03-28 10:14:04
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20550/nhibernate/src/NHibernate Modified Files: nhibernate-mapping-2.0.xsd Log Message: Added missing lazy/outer-join attributes Index: nhibernate-mapping-2.0.xsd =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/nhibernate-mapping-2.0.xsd,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** nhibernate-mapping-2.0.xsd 26 Mar 2005 13:24:38 -0000 1.11 --- nhibernate-mapping-2.0.xsd 28 Mar 2005 10:13:56 -0000 1.12 *************** *** 53,56 **** --- 53,57 ---- </xs:annotation> </xs:attribute> + <xs:attribute name="lazy" type="xs:boolean" use="optional"/> <xs:attribute name="dynamic-update" type="xs:boolean" use="optional" default="false"/> <xs:attribute name="dynamic-insert" type="xs:boolean" use="optional" default="false"/> *************** *** 62,65 **** --- 63,67 ---- <xs:attribute name="schema" type="xs:string" use="optional"/> <xs:attribute name="lazy" type="xs:boolean" use="optional" default="false"/> + <xs:attribute name="outer-join" type="outerJoinStrategy" use="optional"/> <xs:attribute name="cascade" type="cascadeStyle" use="optional"/> <xs:attribute name="where" type="xs:string" use="optional"/> |
From: Michael D. <mik...@us...> - 2005-03-28 06:37:41
|
Update of /cvsroot/nhibernate/nhibernate In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7178 Modified Files: NHibernateSolution.build Log Message: forgot that sdkdoc was commented out... Index: NHibernateSolution.build =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/NHibernateSolution.build,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** NHibernateSolution.build 28 Mar 2005 06:26:37 -0000 1.28 --- NHibernateSolution.build 28 Mar 2005 06:37:32 -0000 1.29 *************** *** 252,256 **** <target name="doc" depends="init" description="Builds the API documentation and the Help Documentation" > ! <!--<call target="sdkdoc" />--> <nant target="clean package" buildfile="doc/reference/doc.build" /> </target> --- 252,256 ---- <target name="doc" depends="init" description="Builds the API documentation and the Help Documentation" > ! <call target="sdkdoc" /> <nant target="clean package" buildfile="doc/reference/doc.build" /> </target> |