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...> - 2004-08-06 03:21:00
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Examples/QuickStart In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11701 Modified Files: User.hbm.xml Log Message: modified type attribute on property element to match quickstart. Index: User.hbm.xml =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Examples/QuickStart/User.hbm.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** User.hbm.xml 24 Jul 2004 20:51:52 -0000 1.1 --- User.hbm.xml 6 Aug 2004 03:20:50 -0000 1.2 *************** *** 4,14 **** <class name="NHibernate.Examples.QuickStart.User, NHibernate.Examples" table="users"> ! <id name="Id" column="LogonId" type="String(20)"> <generator class="assigned" /> </id> ! <property name="UserName" column="Name" type="String(40)"/> ! <property name="Password" type="String(20)"/> ! <property name="EmailAddress" type="String(40)"/> <property name="LastLogon" type="DateTime"/> </class> --- 4,14 ---- <class name="NHibernate.Examples.QuickStart.User, NHibernate.Examples" table="users"> ! <id name="Id" column="LogonId" type="String" length="20"> <generator class="assigned" /> </id> ! <property name="UserName" column="Name" type="String" length="40"/> ! <property name="Password" type="String" length="20"/> ! <property name="EmailAddress" type="String" length="40"/> <property name="LastLogon" type="DateTime"/> </class> |
From: Peter S. <sz...@us...> - 2004-08-04 17:28:03
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2156 Modified Files: FooBarTest.cs Log Message: CollectionsInSelect runs Index: FooBarTest.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/FooBarTest.cs,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** FooBarTest.cs 2 Aug 2004 04:30:36 -0000 1.51 --- FooBarTest.cs 4 Aug 2004 17:27:53 -0000 1.52 *************** *** 845,849 **** [Test] ! [Ignore("Test is failing because sub selects are not working. http://jira.nhibernate.org:8080/browse/NH-69")] public void CollectionsInSelect() { --- 845,849 ---- [Test] ! //[Ignore("Test is failing because sub selects are not working. http://jira.nhibernate.org:8080/browse/NH-69")] public void CollectionsInSelect() { *************** *** 906,913 **** s.Find("select count(*) from Bar as bar, bar.Component.Glarch.ProxyArray as g where g.id in indices(bar.Baz.FooArray)"); s.Find("select max( elements(bar.Baz.FooArray) ) from Bar as bar, bar.Component.Glarch.ProxyArray as g where g.id in indices(bar.Baz.FooArray)"); ! // TODO: subselects - this is the only thing causing tests to fail... ! // s.Find("select count(*) from Bar as bar where 1 in (from bar.Component.Glarch.ProxyArray g where g.Name='foo')"); ! // s.Find("select count(*) from Bar as bar where 1 in (from g in bar.Component.Glarch.ProxyArray.elements where g.Name='foo')"); ! // s.Find("select count(*) from Bar as bar left outer join bar.Component.Glarch.ProxyArray as pg where 1 in (from g in bar.Component.Glarch.ProxyArray)"); } --- 906,912 ---- s.Find("select count(*) from Bar as bar, bar.Component.Glarch.ProxyArray as g where g.id in indices(bar.Baz.FooArray)"); s.Find("select max( elements(bar.Baz.FooArray) ) from Bar as bar, bar.Component.Glarch.ProxyArray as g where g.id in indices(bar.Baz.FooArray)"); ! s.Find("select count(*) from Bar as bar where 1 in (from bar.Component.Glarch.ProxyArray g where g.Name='foo')"); ! s.Find("select count(*) from Bar as bar where 1 in (from g in bar.Component.Glarch.ProxyArray.elements where g.Name='foo')"); ! s.Find("select count(*) from Bar as bar left outer join bar.Component.Glarch.ProxyArray as pg where 1 in (from g in bar.Component.Glarch.ProxyArray)"); } |
From: Peter S. <sz...@us...> - 2004-08-04 17:22:53
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Hql In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1203 Modified Files: QueryTranslator.cs Log Message: Fixed subselect aliasing with one line of fix :) Index: QueryTranslator.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Hql/QueryTranslator.cs,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** QueryTranslator.cs 1 Aug 2004 21:59:11 -0000 1.34 --- QueryTranslator.cs 4 Aug 2004 17:22:44 -0000 1.35 *************** *** 236,240 **** { string alias = StringHelper.Root(path); ! string name = (string) aliasNames[alias]; if (name!=null) { --- 236,240 ---- { string alias = StringHelper.Root(path); ! string name = GetAliasName(alias); if (name!=null) { |
From: Michael D. <mik...@us...> - 2004-08-03 04:21:23
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7178/NHibernate.Test Modified Files: ParentChildTest.cs Log Message: Implemented more tests. Index: ParentChildTest.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/ParentChildTest.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ParentChildTest.cs 15 Jul 2004 19:16:12 -0000 1.3 --- ParentChildTest.cs 3 Aug 2004 04:21:15 -0000 1.4 *************** *** 1,3 **** --- 1,6 ---- using System; + using System.Collections; + + using NHibernate.DomainModel; using NUnit.Framework; *************** *** 36,42 **** [Test] - [Ignore("Test not yet written")] public void CollectionQuery() { } --- 39,94 ---- [Test] public void CollectionQuery() { + ISession s = sessions.OpenSession(); + ITransaction t = s.BeginTransaction(); + + Simple s1 = new Simple(); + s1.Name = "s"; + s1.Count = 0; + Simple s2 = new Simple(); + s2.Count = 2; + Simple s3 = new Simple(); + s3.Count = 3; + s.Save( s1, (long)1 ); + s.Save( s2, (long)2 ); + s.Save( s3, (long)3 ); + Container c = new Container(); + IList l = new ArrayList(); + l.Add(s1); + l.Add(s3); + l.Add(s2); + c.OneToMany = l; + l = new ArrayList(); + l.Add(s1); + l.Add(null); + l.Add(s2); + c.ManyToMany = l; + s.Save(c); + + Assert.AreEqual( 1, s.Find("select c from c in class ContainerX, s in class Simple where c.OneToMany[2] = s").Count ); + Assert.AreEqual( 1, s.Find("select c from c in class ContainerX, s in class Simple where c.ManyToMany[2] = s").Count ); + Assert.AreEqual( 1, s.Find("select c from c in class ContainerX, s in class Simple where s = c.OneToMany[2]").Count ); + Assert.AreEqual( 1, s.Find("select c from c in class ContainerX, s in class Simple where s = c.ManyToMany[2]").Count ); + Assert.AreEqual( 1, s.Find("select c from c in class ContainerX where c.OneToMany[0].Name = 's'").Count ); + Assert.AreEqual( 1, s.Find("select c from c in class ContainerX where c.ManyToMany[0].Name = 's'").Count ); + Assert.AreEqual( 1, s.Find("select c from c in class ContainerX where 's' = c.OneToMany[2 - 2].Name").Count ); + Assert.AreEqual( 1, s.Find("select c from c in class ContainerX where 's' = c.ManyToMany[(3+1)/4-1].Name").Count ); + if( !(dialect is Dialect.MySQLDialect) ) + { + Assert.AreEqual( 1, s.Find("select c from c in class ContainerX where c.ManyToMany[ c.ManyToMany.maxIndex ].Count = 2").Count ); + Assert.AreEqual( 1, s.Find("select c from c in class ContainerX where c.ManyToMany[ maxindex(c.ManyToMany) ].Count = 2").Count ); + } + Assert.AreEqual( 1, s.Find("select c from c in class ContainerX where c.OneToMany[ c.ManyToMany[0].Count ].Name = 's'").Count ); + Assert.AreEqual( 1, s.Find("select c from c in class ContainerX where c.ManyToMany[ c.OneToMany[0].Count ].Name = 's'").Count ); + + s.Delete(c); + s.Delete(s1); + s.Delete(s2); + s.Delete(s3); + + t.Commit(); + s.Close(); + } |
From: Michael D. <mik...@us...> - 2004-08-03 04:20:17
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.DomainModel In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7090/NHibernate.DomainModel Modified Files: Fo.hbm.xml Glarch.hbm.xml ParentChild.hbm.xml Log Message: Modified mappings of properties that are of type System.Object. Index: ParentChild.hbm.xml =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.DomainModel/ParentChild.hbm.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ParentChild.hbm.xml 9 Jul 2004 19:22:11 -0000 1.2 --- ParentChild.hbm.xml 3 Aug 2004 04:20:08 -0000 1.3 *************** *** 1,4 **** <?xml version="1.0"?> ! <hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">> <class --- 1,4 ---- <?xml version="1.0"?> ! <hibernate-mapping xmlns="urn:nhibernate-mapping-2.0"> <class *************** *** 14,18 **** <property name="Count" column="count_"/> <one-to-one name="Child"/> ! <property name="Any" type="Object"> <column name="any_id"/> <column name="any_class"/> --- 14,18 ---- <property name="Count" column="count_"/> <one-to-one name="Child"/> ! <property name="Any"> <column name="any_id"/> <column name="any_class"/> Index: Fo.hbm.xml =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.DomainModel/Fo.hbm.xml,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Fo.hbm.xml 31 Jul 2004 19:14:52 -0000 1.5 --- Fo.hbm.xml 3 Aug 2004 04:20:08 -0000 1.6 *************** *** 28,32 **** type="Int64" /> ! <!-- TODO: need to specify System.Object - nh can't guess this one http://jira.nhibernate.org:8080/browse/NH-82--> <property name="Serial" --- 28,36 ---- type="Int64" /> ! <!-- ! todo: what property matches to a java version of Serializable?? ! This is kind of a hack because NHibernate doesn't match System.Object to ! ObjectType. ! --> <property name="Serial" Index: Glarch.hbm.xml =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.DomainModel/Glarch.hbm.xml,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Glarch.hbm.xml 11 Jul 2004 21:07:24 -0000 1.6 --- Glarch.hbm.xml 3 Aug 2004 04:20:08 -0000 1.7 *************** *** 117,124 **** /> ! <any name="Any" id-type="System.Object"> <column name="`any_id of object`" /> <column name="`any_class of object`" /> ! </any> <property --- 117,124 ---- /> ! <property name="Any" type="Object"> <column name="`any_id of object`" /> <column name="`any_class of object`" /> ! </property> <property |
From: Michael D. <mik...@us...> - 2004-08-03 04:18:52
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Type In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6872/NHibernate/Type Modified Files: TypeFactory.cs Log Message: Added ObjectType to TypeFactory and NHibernate. Index: TypeFactory.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Type/TypeFactory.cs,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** TypeFactory.cs 31 Jul 2004 19:17:40 -0000 1.35 --- TypeFactory.cs 3 Aug 2004 04:18:44 -0000 1.36 *************** *** 73,82 **** //basicTypes.Add(NHibernate.Currency.Name, NHibernate.Currency); - // don't need an ObjectType in the basicMap because object has - // been depreciated in favor of the <any> element in the mapping. The - // <any> element refers to basic types of custom types. - //basicTypes.Add(typeof(object).Name, NHibernate.Object); - //AddToBasicTypes(NHibernate.Object); - // the Timezone class .NET is not even close to the java.util.Timezone class - in // .NET all you can do is get the local Timezone - there is no "factory" method to --- 73,76 ---- *************** *** 98,101 **** --- 92,96 ---- TypeFactory.GetInt32Type(); TypeFactory.GetInt64Type(); + TypeFactory.GetObjectType(); TypeFactory.GetSerializableType(); TypeFactory.GetSingleType(); *************** *** 243,247 **** } ! private static NullableType AddToTypeOfName(string key, NullableType type) { typeByTypeOfName.Add(key, type); --- 238,242 ---- } ! private static IType AddToTypeOfName(string key, IType type) { typeByTypeOfName.Add(key, type); *************** *** 250,254 **** } ! private static NullableType AddToTypeOfNameWithLength(string key, NullableType type) { typeByTypeOfName.Add(key, type); --- 245,249 ---- } ! private static IType AddToTypeOfNameWithLength(string key, IType type) { typeByTypeOfName.Add(key, type); *************** *** 257,261 **** } ! private static NullableType AddToTypeOfNameWithPrecision(string key, NullableType type) { typeByTypeOfName.Add(key, type); --- 252,256 ---- } ! private static IType AddToTypeOfNameWithPrecision(string key, IType type) { typeByTypeOfName.Add(key, type); *************** *** 701,704 **** --- 696,717 ---- /// </summary> /// <returns></returns> + public static IType GetObjectType() + { + string key = typeof(ObjectType).FullName; + + IType returnType = (IType)typeByTypeOfName[key]; + if(returnType==null) + { + returnType = new ObjectType( ); + AddToTypeOfName(key, returnType); + } + + return returnType; + } + + /// <summary> + /// + /// </summary> + /// <returns></returns> public static NullableType GetSingleType() { |
From: Michael D. <mik...@us...> - 2004-08-03 04:18:52
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6872/NHibernate Modified Files: NHibernate.cs Log Message: Added ObjectType to TypeFactory and NHibernate. Index: NHibernate.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/NHibernate.cs,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** NHibernate.cs 30 Apr 2004 18:39:47 -0000 1.18 --- NHibernate.cs 3 Aug 2004 04:18:44 -0000 1.19 *************** *** 92,95 **** --- 92,100 ---- /// <summary> + /// NHibernate System.Object type + /// </summary> + public static readonly IType Object = TypeFactory.GetObjectType(); + + /// <summary> /// NHibernate serializable type /// </summary> |
From: Michael D. <mik...@us...> - 2004-08-02 04:31:18
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Expression In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27706/NHibernate/Expression Modified Files: Expression.cs Added Files: EqPropertyExpression.cs LePropertyExpression.cs LtPropertyExpression.cs PropertyExpression.cs Log Message: Added missing Property Expressions from http://jira.nhibernate.org:8080/browse/NH-22 Index: Expression.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Expression/Expression.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Expression.cs 6 Apr 2004 04:11:19 -0000 1.8 --- Expression.cs 2 Aug 2004 04:30:37 -0000 1.9 *************** *** 158,161 **** --- 158,194 ---- } + + /// <summary> + /// Apply an "equal" constraint to two properties + /// </summary> + /// <param name="propertyName">The lhs Property Name</param> + /// <param name="otherPropertyName">The rhs Property Name</param> + /// <returns>A <see cref="EqPropertyExpression"/> .</returns> + public static Expression EqProperty(String propertyName, String otherPropertyName) + { + return new EqPropertyExpression(propertyName, otherPropertyName); + } + + /// <summary> + /// Apply a "less than" constraint to two properties + /// </summary> + /// <param name="propertyName">The lhs Property Name</param> + /// <param name="otherPropertyName">The rhs Property Name</param> + /// <returns>A <see cref="LtPropertyExpression"/> .</returns> + public static Expression LtProperty(String propertyName, String otherPropertyName) + { + return new LtPropertyExpression(propertyName, otherPropertyName); + } + + /// <summary> + /// Apply a "less than or equal" constraint to two properties + /// </summary> + /// <param name="propertyName">The lhs Property Name</param> + /// <param name="otherPropertyName">The rhs Property Name</param> + /// <returns>A <see cref="LePropertyExpression"/> .</returns> + public static Expression LeProperty(String propertyName, String otherPropertyName) + { + return new LePropertyExpression(propertyName, otherPropertyName); + } /// <summary> /// Return the conjuction of two expressions --- NEW FILE: LtPropertyExpression.cs --- using System; namespace NHibernate.Expression { public class LtPropertyExpression : PropertyExpression { public LtPropertyExpression(string propertyName, string otherPropertyName) : base(propertyName, otherPropertyName) { } protected override string Op { get { return " < "; } } } } --- NEW FILE: EqPropertyExpression.cs --- using System; namespace NHibernate.Expression { public class EqPropertyExpression : PropertyExpression { public EqPropertyExpression(string propertyName, string otherPropertyName) : base(propertyName, otherPropertyName) { } protected override string Op { get { return " = "; } } } } --- NEW FILE: PropertyExpression.cs --- using System; using NHibernate.Engine; using NHibernate.SqlCommand; using NHibernate.Util; namespace NHibernate.Expression { /// <summary> /// Superclass for comparisons between two properties (with SQL binary operators) /// </summary> public abstract class PropertyExpression : Expression { private string propertyName; private string otherPropertyName; private static TypedValue[] NoTypedValues = new TypedValue[0]; protected PropertyExpression(string propertyName, string otherPropertyName) { this.propertyName = propertyName; this.otherPropertyName = otherPropertyName; } public override SqlString ToSqlString(ISessionFactoryImplementor factory, System.Type persistentClass, string alias) { SqlStringBuilder sqlBuilder = new SqlStringBuilder(); string[] columnNames = GetColumns(factory, persistentClass, propertyName, alias); string[] otherColumnNames = GetColumns(factory, persistentClass, otherPropertyName, alias); bool andNeeded = false; for (int i = 0; i < columnNames.Length; i++) { if (andNeeded) sqlBuilder.Add(" AND "); andNeeded = true; sqlBuilder.Add(columnNames[i]).Add(Op).Add(otherColumnNames[i]); } return sqlBuilder.ToSqlString(); //TODO: get SQL rendering out of this package! } public override TypedValue[] GetTypedValues(ISessionFactoryImplementor sessionFactory, System.Type persistentClass) { return NoTypedValues; } public override string ToString() { return propertyName + Op + otherPropertyName; } protected abstract string Op { get; } } } --- NEW FILE: LePropertyExpression.cs --- using System; namespace NHibernate.Expression { public class LePropertyExpression : PropertyExpression { public LePropertyExpression(string propertyName, string otherPropertyName) : base(propertyName, otherPropertyName) { } protected override string Op { get { return " <= "; } } } } |
From: Michael D. <mik...@us...> - 2004-08-02 04:31:15
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27706/NHibernate.Test Modified Files: FooBarTest.cs NHibernate.Test-1.1.csproj Log Message: Added missing Property Expressions from http://jira.nhibernate.org:8080/browse/NH-22 Index: FooBarTest.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/FooBarTest.cs,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** FooBarTest.cs 1 Aug 2004 22:12:45 -0000 1.50 --- FooBarTest.cs 2 Aug 2004 04:30:36 -0000 1.51 *************** *** 501,508 **** s.Flush(); - //TODO: need to add PropertyExpressions to Expression namespace. IList list = s.CreateCriteria(typeof(Foo)) .Add( Expression.Expression.Eq( "Integer", f.Integer ) ) ! //.Add( Expression.Expression.EqProperty("integer", "integer") ) .Add( Expression.Expression.Like( "String", f.String) ) .Add( Expression.Expression.In("Boolean", new bool[] {f.Boolean, f.Boolean} ) ) --- 501,507 ---- s.Flush(); IList list = s.CreateCriteria(typeof(Foo)) .Add( Expression.Expression.Eq( "Integer", f.Integer ) ) ! .Add( Expression.Expression.EqProperty("Integer", "Integer") ) .Add( Expression.Expression.Like( "String", f.String) ) .Add( Expression.Expression.In("Boolean", new bool[] {f.Boolean, f.Boolean} ) ) Index: NHibernate.Test-1.1.csproj =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/NHibernate.Test-1.1.csproj,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** NHibernate.Test-1.1.csproj 23 Jul 2004 15:46:32 -0000 1.31 --- NHibernate.Test-1.1.csproj 2 Aug 2004 04:30:36 -0000 1.32 *************** *** 292,295 **** --- 292,300 ---- /> <File + RelPath = "ExpressionTest\PropertyExpressionFixture.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "ExpressionTest\SimpleExpressionFixture.cs" SubType = "Code" |
From: Michael D. <mik...@us...> - 2004-08-02 04:30:50
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27706/NHibernate Modified Files: NHibernate-1.1.csproj Log Message: Added missing Property Expressions from http://jira.nhibernate.org:8080/browse/NH-22 Index: NHibernate-1.1.csproj =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/NHibernate-1.1.csproj,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** NHibernate-1.1.csproj 22 Jul 2004 13:31:36 -0000 1.32 --- NHibernate-1.1.csproj 2 Aug 2004 04:30:35 -0000 1.33 *************** *** 664,667 **** --- 664,672 ---- /> <File + RelPath = "Expression\EqPropertyExpression.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "Expression\Expression.cs" SubType = "Code" *************** *** 699,702 **** --- 704,712 ---- /> <File + RelPath = "Expression\LePropertyExpression.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "Expression\LikeExpression.cs" SubType = "Code" *************** *** 714,717 **** --- 724,732 ---- /> <File + RelPath = "Expression\LtPropertyExpression.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "Expression\NotExpression.cs" SubType = "Code" *************** *** 739,742 **** --- 754,762 ---- /> <File + RelPath = "Expression\PropertyExpression.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "Expression\SimpleExpression.cs" SubType = "Code" |
From: Michael D. <mik...@us...> - 2004-08-02 04:30:46
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/ExpressionTest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27706/NHibernate.Test/ExpressionTest Added Files: PropertyExpressionFixture.cs Log Message: Added missing Property Expressions from http://jira.nhibernate.org:8080/browse/NH-22 --- NEW FILE: PropertyExpressionFixture.cs --- using System; using NExpression = NHibernate.Expression; using NHibernate.SqlCommand; using NHibernate.DomainModel; using NUnit.Framework; namespace NHibernate.Test.ExpressionTest { /// <summary> /// Test the PropertyExpression class. /// </summary> /// <remarks> /// There are no need for the subclasses EqPropertyExpression, /// LePropertyExpression, or LtPropertyExpression to have their own /// TestFixtures because all they do is override one property. /// </remarks> [TestFixture] public class PropertyExpressionFixture : BaseExpressionFixture { [Test] public void SqlStringTest() { ISession session = factory.OpenSession(); NExpression.Expression andExpression = NExpression.Expression.EqProperty("Address", "Name"); SqlString sqlString = andExpression.ToSqlString(factoryImpl, typeof(Simple), "simple_alias"); string expectedSql = "simple_alias.address = simple_alias.Name"; CompareSqlStrings(sqlString, expectedSql); session.Close(); } } } |
From: Michael D. <mik...@us...> - 2004-08-01 22:13:12
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/NHSpecificTest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8527/NHibernate.Test/NHSpecificTest Modified Files: NodeFixture.cs Log Message: Removed old comments that no longer apply. Index: NodeFixture.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/NHSpecificTest/NodeFixture.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** NodeFixture.cs 9 Jun 2004 01:06:22 -0000 1.1 --- NodeFixture.cs 1 Aug 2004 22:13:03 -0000 1.2 *************** *** 85,103 **** Assert.IsTrue(levelOneNode2.PreviousNodes.Contains(startNode2), "Level One can be reached through Start Node"); - - // // TODO: get rid of this HACK that was used to find out what was causing the problem - // // lets test out my theory that the problem is the "END" node being loaded during flush by just loading - // // it before the flush. If it loads before the flush I don't think there will be any problems. See - // // http://jira.nhibernate.org:8080/browse/NH-20 for what I think is happening... - // foreach(Node node2 in levelOneNode2.DestinationNodes.Keys) - // { - // System.Diagnostics.Debug.WriteLine("touching node2's destinations = " + node2.DestinationNodes.Count); - // foreach(Node node3 in node2.DestinationNodes.Keys) - // { - // System.Diagnostics.Debug.WriteLine("touching node3's destinations - " + node3.DestinationNodes.Count); - // } - // } - - //foreach t2.Commit(); --- 85,88 ---- *************** *** 106,112 **** } - - - } } --- 91,94 ---- |
From: Michael D. <mik...@us...> - 2004-08-01 22:12:54
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8421/NHibernate.Test Modified Files: FooBarTest.cs FumTest.cs Log Message: Added some details to why the test are being ignored. Index: FooBarTest.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/FooBarTest.cs,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** FooBarTest.cs 28 Jul 2004 15:14:51 -0000 1.49 --- FooBarTest.cs 1 Aug 2004 22:12:45 -0000 1.50 *************** *** 604,608 **** [Test] ! //[Ignore("Test not written yet.")] public void CollectionWhere() { --- 604,608 ---- [Test] ! [Ignore("ISession.Filter is not working. http://jira.nhibernate.org:8080/browse/NH-80")] public void CollectionWhere() { *************** *** 907,910 **** --- 907,911 ---- s.Find("select count(*) from Bar as bar, bar.Component.Glarch.ProxyArray as g where g.id in indices(bar.Baz.FooArray)"); s.Find("select max( elements(bar.Baz.FooArray) ) from Bar as bar, bar.Component.Glarch.ProxyArray as g where g.id in indices(bar.Baz.FooArray)"); + // TODO: subselects - this is the only thing causing tests to fail... // s.Find("select count(*) from Bar as bar where 1 in (from bar.Component.Glarch.ProxyArray g where g.Name='foo')"); // s.Find("select count(*) from Bar as bar where 1 in (from g in bar.Component.Glarch.ProxyArray.elements where g.Name='foo')"); Index: FumTest.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/FumTest.cs,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** FumTest.cs 31 Jul 2004 19:19:10 -0000 1.10 --- FumTest.cs 1 Aug 2004 22:12:45 -0000 1.11 *************** *** 193,197 **** [Test] ! [Ignore("ISession.Filter() not implemented. Everything else passes.")] public void CompositeIDQuery() { --- 193,197 ---- [Test] ! [Ignore("ISession.Filter() not implemented. Everything else passes. http://jira.nhibernate.org:8080/browse/NH-80")] public void CompositeIDQuery() { |
From: Michael D. <mik...@us...> - 2004-08-01 21:59:42
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5976/NHibernate.Test Modified Files: MultiTableTest.cs Log Message: Implemented more tests. Index: MultiTableTest.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/MultiTableTest.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** MultiTableTest.cs 1 Aug 2004 15:01:40 -0000 1.3 --- MultiTableTest.cs 1 Aug 2004 21:59:33 -0000 1.4 *************** *** 22,31 **** [Test] - [Ignore("Problems generating correct sql: http://jira.nhibernate.org:8080/browse/NH-83")] public void TestJoins() { - // the commented out hql is what does not work because of 83 ISession s = sessions.OpenSession(); ! //s.Find("from SubMulti sm join sm.Children smc where smc.Name > 'a'"); s.Find("select s, ya from LessSimple s join s.YetAnother ya"); s.Find("from LessSimple s1 join s1.Bag s2"); --- 22,29 ---- [Test] public void TestJoins() { ISession s = sessions.OpenSession(); ! s.Find("from SubMulti sm join sm.Children smc where smc.Name > 'a'"); s.Find("select s, ya from LessSimple s join s.YetAnother ya"); s.Find("from LessSimple s1 join s1.Bag s2"); *************** *** 35,39 **** s.Find("from Simple s, LessSimple ls"); s.Find("from LessSimple ls join ls.Set s where s.Name > 'a'"); ! //s.Find("from Po po join po.List sm where sm.Name > 'a'"); s.Find("from LessSimple ls inner join ls.Another s where s.Name is not null"); s.Find("from LessSimple ls where ls.Other.Another.Name is not null"); --- 33,37 ---- s.Find("from Simple s, LessSimple ls"); s.Find("from LessSimple ls join ls.Set s where s.Name > 'a'"); ! s.Find("from Po po join po.List sm where sm.Name > 'a'"); s.Find("from LessSimple ls inner join ls.Another s where s.Name is not null"); s.Find("from LessSimple ls where ls.Other.Another.Name is not null"); *************** *** 42,46 **** [Test] ! [Ignore("Problems generating correct sql: http://jira.nhibernate.org:8080/browse/NH-83")] public void SubclassCollection() { --- 40,44 ---- [Test] ! [Ignore("Filter Not Working http://jira.nhibernate.org:8080/browse/NH-80")] public void SubclassCollection() { *************** *** 55,58 **** --- 53,58 ---- list.Add(sm1); list.Add(sm2); + anotherList.Add(sm1); + anotherList.Add(sm2); sm1.Parent = sm; sm2.Parent = sm; *************** *** 66,83 **** // TODO: I don't understand why h2.0.3 issues a select statement here ! // Invalid column "Name" - 83 ! //Assert.AreEqual( 2, s.Find("select s from SubMulti as sm join sm.Children as s where s.Amount>-1 and s.Name is null").Count ); Assert.AreEqual( 2, s.Find("select elements(sm.Children) from SubMulti as sm").Count ); ! // Invalid column "Name" - 83 ! //Assert.AreEqual( 1, s.Find("select distinct sm from SubMulti as sm join sm.Children as s where s.Amount>-1 and s.Name is null").Count ); sm = (SubMulti)s.Load( typeof(SubMulti), id ); Assert.AreEqual( 2, sm.Children.Count ); //TODO: code for a Filter here ! IEnumerator enumer = s.Enumerable("select distinct s from s in class SubMulti where s.MoreChildren[1].Amount < 1.0").GetEnumerator(); - // TODO: no rows returned here... Assert.IsTrue( enumer.MoveNext() ); ! Assert.AreSame( sm, enumer.MoveNext() ); Assert.AreEqual( 2, sm.MoreChildren.Count ); s.Delete(sm); --- 66,80 ---- // TODO: I don't understand why h2.0.3 issues a select statement here ! Assert.AreEqual( 2, s.Find("select s from SubMulti as sm join sm.Children as s where s.Amount>-1 and s.Name is null").Count ); Assert.AreEqual( 2, s.Find("select elements(sm.Children) from SubMulti as sm").Count ); ! Assert.AreEqual( 1, s.Find("select distinct sm from SubMulti as sm join sm.Children as s where s.Amount>-1 and s.Name is null").Count ); sm = (SubMulti)s.Load( typeof(SubMulti), id ); Assert.AreEqual( 2, sm.Children.Count ); //TODO: code for a Filter here ! IEnumerator enumer = s.Enumerable("select distinct s from s in class SubMulti where s.MoreChildren[1].Amount < 1.0").GetEnumerator(); Assert.IsTrue( enumer.MoveNext() ); ! Assert.AreSame( sm, enumer.Current ); Assert.AreEqual( 2, sm.MoreChildren.Count ); s.Delete(sm); *************** *** 115,119 **** [Test] - [Ignore("Problems generating correct sql: http://jira.nhibernate.org:8080/browse/NH-83")] public void Queries() { --- 112,115 ---- *************** *** 138,144 **** s.Find("select s.Count from s in class Simple"); s.Find("from s in class LessSimple where s.Another.Name='name'"); ! // bug 83 ! //s.Find("from s in class LessSimple where s.YetAnother.Name='name'"); ! //s.Find("from s in class LessSimple where s.YetAnother.Name='name' and s.YetAnother.Foo is null"); s.Find("from s in class Simple where s.Count=1"); s.Find("select s.Count from s in class Simple, ls in class LessSimple where ls.Another=s"); --- 134,139 ---- s.Find("select s.Count from s in class Simple"); s.Find("from s in class LessSimple where s.Another.Name='name'"); ! s.Find("from s in class LessSimple where s.YetAnother.Name='name'"); ! s.Find("from s in class LessSimple where s.YetAnother.Name='name' and s.YetAnother.Foo is null"); s.Find("from s in class Simple where s.Count=1"); s.Find("select s.Count from s in class Simple, ls in class LessSimple where ls.Another=s"); *************** *** 178,202 **** [Test] - [Ignore("Test not yet written")] public void MultiTable() { } [Test] - [Ignore("Test not yet written")] public void MutliTableGeneratedId() { } [Test] - [Ignore("Test not yet written")] public void MultiTableCollections() { } [Test] - [Ignore("Test not yet written")] public void MultiTableManyToOne() { } --- 173,555 ---- [Test] public void MultiTable() { + ISession s = sessions.OpenSession(); + ITransaction t = s.BeginTransaction(); + Multi multi = new Multi(); + multi.ExtraProp = "extra"; + multi.Name = "name"; + Simple simp = new Simple(); + simp.Date = DateTime.Now; + simp.Name = "simp"; + object mid; + object sid; + if( (dialect is Dialect.SybaseDialect) || (dialect is Dialect.MsSql2000Dialect) ) + { + mid = s.Save(multi); + sid = s.Save(simp); + } + else + { + mid = 123L; + sid = 1234L; + s.Save(multi, mid); + s.Save(simp, sid); + } + SubMulti sm = new SubMulti(); + sm.Amount = 66.5f; + object smid; + if( (dialect is Dialect.SybaseDialect) || (dialect is Dialect.MsSql2000Dialect) ) + { + smid = s.Save(sm); + } + else + { + smid = 2L; + s.Save(sm, smid); + } + t.Commit(); + s.Close(); + + s = sessions.OpenSession(); + t = s.BeginTransaction(); + multi.ExtraProp = multi.ExtraProp + "2"; + multi.Name = "new name"; + s.Update( multi, mid ); + simp.Name = "new name"; + s.Update( simp, sid ); + sm.Amount = 456.7f; + s.Update( sm, smid ); + t.Commit(); + s.Close(); + + s = sessions.OpenSession(); + t = s.BeginTransaction(); + multi = (Multi)s.Load( typeof(Multi), mid ); + Assert.AreEqual( "extra2", multi.ExtraProp ); + multi.ExtraProp = multi.ExtraProp + "3"; + Assert.AreEqual( "new name", multi.Name ); + multi.Name = "newer name"; + sm = (SubMulti) s.Load( typeof(SubMulti), smid ); + Assert.AreEqual( 456.7f, sm.Amount ); + sm.Amount = 23423f; + t.Commit(); + s.Close(); + + s = sessions.OpenSession(); + t = s.BeginTransaction(); + multi = (Multi)s.Load( typeof(Simple), mid ); + simp = (Simple)s.Load( typeof(Simple), sid ); + Assert.IsFalse( simp is Multi ); + Assert.IsTrue( multi is Multi ); + Assert.AreEqual( "extra23", multi.ExtraProp ); + Assert.AreEqual( "newer name", multi.Name ); + t.Commit(); + s.Close(); + + s = sessions.OpenSession(); + t = s.BeginTransaction(); + IEnumerator enumer = s.Enumerable("select\n\ns from s in class Simple where s.Count>0").GetEnumerator(); + bool foundSimp = false; + bool foundMulti = false; + bool foundSubMulti = false; + while( enumer.MoveNext() ) + { + object o = enumer.Current; + if( (o is Simple) && !(o is Multi) ) foundSimp = true; + if( (o is Multi) && !(o is SubMulti) ) foundMulti = true; + if( o is SubMulti ) foundSubMulti = true; + } + Assert.IsTrue( foundSimp ); + Assert.IsTrue( foundMulti ); + Assert.IsTrue( foundSubMulti ); + + s.Find("from m in class Multi where m.Count>0 and m.ExtraProp is not null"); + s.Find("from m in class Simple where m.Count>0 and m.Name is not null"); + s.Find("from m in class LessSimple where m.Other is not null"); + s.Find("from m in class Multi where m.Other.id = 1"); + s.Find("from m in class SubMulti where m.Amount > 0.0"); + + Assert.AreEqual( 2, s.Find("from m in class Multi").Count ); + + //if( !(dialect is Dialect.HSQLDialect) ) + //{ + Assert.AreEqual( 1, s.Find("from m in class Multi where m.class = SubMulti").Count ); + Assert.AreEqual( 1, s.Find("from m in class Simple where m.class = Multi").Count ); + //} + + Assert.AreEqual( 3, s.Find("from s in class Simple").Count ); + Assert.AreEqual( 0, s.Find("from ls in class LessSimple").Count ); + Assert.AreEqual( 1, s.Find("from sm in class SubMulti").Count ); + + s.Find("from ls in class LessSimple, s in ls.Bag.elements where s.id is not null"); + s.Find("from ls in class LessSimple, s in ls.Set.elements where s.id is not null"); + s.Find("from sm in class SubMulti where exists sm.Children.elements"); + + t.Commit(); + s.Close(); + + s = sessions.OpenSession(); + t = s.BeginTransaction(); + multi = (Multi)s.Load( typeof(Simple), mid, LockMode.Upgrade ); + simp = (Simple)s.Load( typeof(Simple), sid ); + s.Lock( simp, LockMode.UpgradeNoWait ); + t.Commit(); + s.Close(); + + s = sessions.OpenSession(); + t = s.BeginTransaction(); + s.Update( multi, mid ); + s.Delete(multi); + Assert.AreEqual( 2, s.Delete("from s in class Simple") ); + t.Commit(); + s.Close(); + + } [Test] public void MutliTableGeneratedId() { + ISession s = sessions.OpenSession(); + ITransaction t = s.BeginTransaction(); + Multi multi = new Multi(); + multi.ExtraProp = "extra"; + multi.Name = "name"; + Simple simp = new Simple(); + simp.Date = DateTime.Now; + simp.Name = "simp"; + object multiId = s.Save(multi); + object simpId = s.Save(simp); + SubMulti sm = new SubMulti(); + sm.Amount = 66.5f; + object smId = s.Save(sm); + t.Commit(); + s.Close(); + + s = sessions.OpenSession(); + t = s.BeginTransaction(); + multi.ExtraProp += "2"; + multi.Name = "new name"; + s.Update( multi, multiId ); + simp.Name = "new name"; + s.Update( simp, simpId ); + sm.Amount = 456.7f; + s.Update( sm, smId ); + t.Commit(); + s.Close(); + + s = sessions.OpenSession(); + t = s.BeginTransaction(); + multi = (Multi)s.Load( typeof(Multi), multiId ); + Assert.AreEqual( "extra2", multi.ExtraProp ); + multi.ExtraProp += "3"; + Assert.AreEqual( "new name", multi.Name ); + multi.Name = "newer name"; + sm = (SubMulti)s.Load( typeof(SubMulti), smId ); + Assert.AreEqual( 456.7f, sm.Amount ); + sm.Amount = 23423f; + t.Commit(); + s.Close(); + + s = sessions.OpenSession(); + t = s.BeginTransaction(); + multi = (Multi)s.Load( typeof(Simple), multiId ); + simp = (Simple)s.Load( typeof(Simple), simpId ); + Assert.IsFalse( simp is Multi ); + Assert.IsTrue( multi is Multi ); + Assert.AreEqual( "extra23", multi.ExtraProp ); + Assert.AreEqual( "newer name", multi.Name ); + t.Commit(); + s.Close(); + + s = sessions.OpenSession(); + t = s.BeginTransaction(); + IEnumerable enumer = s.Enumerable("select\n\ns from s in class Simple where s.Count>0"); + bool foundSimp = false; + bool foundMulti = false; + bool foundSubMulti = false; + + foreach(object obj in enumer) + { + if( (obj is Simple) && !(obj is Multi) ) foundSimp = true; + if( (obj is Multi) && !(obj is SubMulti) ) foundMulti = true; + if( obj is SubMulti ) foundSubMulti = true; + } + Assert.IsTrue(foundSimp); + Assert.IsTrue(foundMulti); + Assert.IsTrue(foundSubMulti); + + s.Find("from m in class Multi where m.Count>0 and m.ExtraProp is not null"); + s.Find("from m in class Simple where m.Count>0 and m.Name is not null"); + s.Find("from m in class LessSimple where m.Other is not null"); + s.Find("from m in class Multi where m.Other.id = 1"); + s.Find("from m in class SubMulti where m.Amount > 0.0"); + + Assert.AreEqual( 2, s.Find("from m in class Multi").Count ); + Assert.AreEqual( 3, s.Find("from s in class Simple").Count ); + Assert.AreEqual( 0, s.Find("from s in class LessSimple").Count ); + Assert.AreEqual( 1, s.Find("from sm in class SubMulti").Count ); + + s.Find("from ls in class LessSimple, s in ls.Bag.elements where s.id is not null"); + s.Find("from sm in class SubMulti where exists sm.Children.elements"); + + t.Commit(); + s.Close(); + + s = sessions.OpenSession(); + t = s.BeginTransaction(); + multi = (Multi)s.Load( typeof(Simple), multiId, LockMode.Upgrade ); + simp = (Simple)s.Load( typeof(Simple), simpId ); + s.Lock( simp, LockMode.UpgradeNoWait ); + t.Commit(); + s.Close(); + + s = sessions.OpenSession(); + t = s.BeginTransaction(); + s.Update( multi, multiId ); + s.Delete(multi); + Assert.AreEqual( 2, s.Delete("from s in class Simple") ); + t.Commit(); + s.Close(); } [Test] public void MultiTableCollections() { + //if( dialect is Dialect.HSQLDialect) return; + + ISession s = sessions.OpenSession(); + ITransaction t = s.BeginTransaction(); + Assert.AreEqual( 0, s.Find("from s in class Simple").Count ); + Multi multi = new Multi(); + multi.ExtraProp = "extra"; + multi.Name = "name"; + Simple simp = new Simple(); + simp.Date = DateTime.Now; + simp.Name = "simp"; + object mid; + object sid; + if( (dialect is Dialect.SybaseDialect) || (dialect is Dialect.MsSql2000Dialect) ) + { + mid = s.Save(multi); + sid = s.Save(simp); + } + else + { + mid = 123L; + sid = 1234L; + s.Save(multi, mid); + s.Save(simp, sid); + } + LessSimple ls = new LessSimple(); + ls.Other = ls; + ls.Another = ls; + ls.YetAnother = ls; + ls.Name = "Less Simple"; + IDictionary dict = new Hashtable(); + ls.Set = dict; + dict.Add( multi, new object() ); + dict.Add( simp, new object() ); + object id; + if( (dialect is Dialect.SybaseDialect) || (dialect is Dialect.MsSql2000Dialect) ) + { + id = s.Save(ls); + } + else + { + id = 2L; + s.Save(ls, id); + } + t.Commit(); + s.Close(); + Assert.AreSame( ls, ls.Other ); + Assert.AreSame( ls, ls.Another ); + Assert.AreSame( ls, ls.YetAnother ); + + s = sessions.OpenSession(); + t = s.BeginTransaction(); + ls = (LessSimple)s.Load( typeof(LessSimple), id ); + Assert.AreSame( ls, ls.Other ); + Assert.AreSame( ls, ls.Another ); + Assert.AreSame( ls, ls.YetAnother ); + Assert.AreEqual( 2, ls.Set.Count ); + + int foundMulti = 0; + int foundSimple = 0; + + foreach(object obj in ls.Set.Keys) + { + if( obj is Simple ) foundSimple++; + if( obj is Multi ) foundMulti++; + } + Assert.AreEqual( 2, foundSimple ); + Assert.AreEqual( 1, foundMulti ); + Assert.AreEqual( 3, s.Delete("from s in class Simple") ); + t.Commit(); + s.Close(); + + } [Test] public void MultiTableManyToOne() { + //if( dialect is Dialect.HSQLDialect) return; + + ISession s = sessions.OpenSession(); + ITransaction t = s.BeginTransaction(); + Assert.AreEqual( 0, s.Find("from s in class Simple").Count ); + Multi multi = new Multi(); + multi.ExtraProp = "extra"; + multi.Name = "name"; + Simple simp = new Simple(); + simp.Date = DateTime.Now; + simp.Name = "simp"; + object mid; + + if( (dialect is Dialect.SybaseDialect) || (dialect is Dialect.MsSql2000Dialect) ) + { + mid = s.Save(multi); + } + else + { + mid = 123L; + s.Save(multi, mid); + } + LessSimple ls = new LessSimple(); + ls.Other = ls; + ls.Another = multi; + ls.YetAnother = ls; + ls.Name = "Less Simple"; + object id; + if( (dialect is Dialect.SybaseDialect) || (dialect is Dialect.MsSql2000Dialect) ) + { + id = s.Save(ls); + } + else + { + id = 2L; + s.Save(ls, id); + } + t.Commit(); + s.Close(); + + Assert.AreSame(ls, ls.Other); + Assert.AreSame(multi, ls.Another); + Assert.AreSame(ls, ls.YetAnother); + + s = sessions.OpenSession(); + t = s.BeginTransaction(); + ls = (LessSimple)s.Load( typeof(LessSimple), id ); + Assert.AreSame(ls, ls.Other); + Assert.AreSame(ls, ls.YetAnother); + Assert.AreEqual("name", ls.Another.Name); + Assert.IsTrue(ls.Another is Multi); + s.Delete(ls); + s.Delete(ls.Another); + t.Commit(); + s.Close(); + } |
From: Michael D. <mik...@us...> - 2004-08-01 21:59:19
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Sql In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5934/NHibernate/Sql Modified Files: QuerySelect.cs Log Message: Changed some write-only properties to methods. Index: QuerySelect.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Sql/QuerySelect.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** QuerySelect.cs 30 Apr 2004 13:10:18 -0000 1.5 --- QuerySelect.cs 1 Aug 2004 21:59:11 -0000 1.6 *************** *** 83,108 **** } ! public ICollection WhereTokens { //if ( conjunctiveWhere.length()>0 ) conjunctiveWhere.append(" and "); ! set { AppendTokens(where, value); } } ! public ICollection GroupByTokens { //if ( groupBy.length()>0 ) groupBy.append(" and "); ! set { AppendTokens(groupBy, value); } } ! public ICollection OrderByTokens { //if ( orderBy.length()>0 ) orderBy.append(" and "); ! set { AppendTokens(orderBy, value); } } ! public ICollection HavingTokens { //if ( having.length()>0 ) having.append(" and "); ! set { AppendTokens(having, value); } } --- 83,108 ---- } ! public void SetWhereTokens(ICollection tokens) { //if ( conjunctiveWhere.length()>0 ) conjunctiveWhere.append(" and "); ! AppendTokens(where, tokens); } ! public void SetGroupByTokens(ICollection tokens) { //if ( groupBy.length()>0 ) groupBy.append(" and "); ! AppendTokens(groupBy, tokens); } ! public void SetOrderByTokens(ICollection tokens) { //if ( orderBy.length()>0 ) orderBy.append(" and "); ! AppendTokens(orderBy, tokens); } ! public void SetHavingTokens(ICollection tokens) { //if ( having.length()>0 ) having.append(" and "); ! AppendTokens(having, tokens); } |
From: Michael D. <mik...@us...> - 2004-08-01 21:59:19
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Hql In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5934/NHibernate/Hql Modified Files: QueryTranslator.cs Log Message: Changed some write-only properties to methods. Index: QueryTranslator.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Hql/QueryTranslator.cs,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** QueryTranslator.cs 1 Aug 2004 14:58:45 -0000 1.33 --- QueryTranslator.cs 1 Aug 2004 21:59:11 -0000 1.34 *************** *** 583,591 **** MergeJoins( sql.JoinFragment ); ! sql.WhereTokens = whereTokens; ! sql.GroupByTokens = groupByTokens; ! sql.HavingTokens = havingTokens; ! sql.OrderByTokens = orderByTokens; if ( CollectionPersister!=null && CollectionPersister.HasOrdering ) --- 583,591 ---- MergeJoins( sql.JoinFragment ); ! sql.SetWhereTokens(whereTokens); ! sql.SetGroupByTokens(groupByTokens); ! sql.SetHavingTokens(havingTokens); ! sql.SetOrderByTokens(orderByTokens); if ( CollectionPersister!=null && CollectionPersister.HasOrdering ) |
From: Michael D. <mik...@us...> - 2004-08-01 21:58:10
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Persister In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5746/NHibernate/Persister Modified Files: NormalizedEntityPersister.cs Log Message: fixed up aliasing in ToColumns and use of where attribute in QueryWhereFragment Index: NormalizedEntityPersister.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Persister/NormalizedEntityPersister.cs,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** NormalizedEntityPersister.cs 1 Aug 2004 15:00:18 -0000 1.22 --- NormalizedEntityPersister.cs 1 Aug 2004 21:58:02 -0000 1.23 *************** *** 1452,1456 **** // make sure an Alias was actually passed into the statement if(alias!=null && alias!=String.Empty) ! return StringHelper.Prefix(cols, alias + StringHelper.Dot); else return cols; --- 1452,1456 ---- // make sure an Alias was actually passed into the statement if(alias!=null && alias!=String.Empty) ! return StringHelper.Prefix(cols, Alias(alias, tableIndex) + StringHelper.Dot); else return cols; *************** *** 1533,1537 **** public override string QueryWhereFragment(string alias, bool innerJoin, bool includeSubclasses) { ! return WhereJoinFragment(alias, innerJoin, includeSubclasses); } --- 1533,1539 ---- public override string QueryWhereFragment(string alias, bool innerJoin, bool includeSubclasses) { ! string result = WhereJoinFragment(alias, innerJoin, includeSubclasses); ! if( HasWhere ) result += " and " + GetSQLWhereString(alias); ! return result; } |
From: Michael D. <mik...@us...> - 2004-08-01 15:01:50
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10008/NHibernate.Test Modified Files: MultiTableTest.cs Log Message: Implemented more tests. Index: MultiTableTest.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/MultiTableTest.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** MultiTableTest.cs 9 Jun 2004 01:22:37 -0000 1.2 --- MultiTableTest.cs 1 Aug 2004 15:01:40 -0000 1.3 *************** *** 1,3 **** --- 1,6 ---- using System; + using System.Collections; + + using NHibernate.DomainModel; using NUnit.Framework; *************** *** 19,49 **** [Test] ! [Ignore("Test not yet written")] public void TestJoins() { } [Test] ! [Ignore("Test not yet written")] public void SubclassCollection() { } [Test] - [Ignore("Test not yet written")] public void CollectionOnly() { } [Test] ! [Ignore("Test not yet written")] public void Queries() { } [Test] - [Ignore("Test not yet written")] public void Constraints() { } --- 22,178 ---- [Test] ! [Ignore("Problems generating correct sql: http://jira.nhibernate.org:8080/browse/NH-83")] public void TestJoins() { + // the commented out hql is what does not work because of 83 + ISession s = sessions.OpenSession(); + //s.Find("from SubMulti sm join sm.Children smc where smc.Name > 'a'"); + s.Find("select s, ya from LessSimple s join s.YetAnother ya"); + s.Find("from LessSimple s1 join s1.Bag s2"); + s.Find("from LessSimple s1 left join s1.Bag s2"); + s.Find("select s, a from LessSimple s join s.Another a"); + s.Find("select s, a from LessSimple s left join s.Another a"); + s.Find("from Simple s, LessSimple ls"); + s.Find("from LessSimple ls join ls.Set s where s.Name > 'a'"); + //s.Find("from Po po join po.List sm where sm.Name > 'a'"); + s.Find("from LessSimple ls inner join ls.Another s where s.Name is not null"); + s.Find("from LessSimple ls where ls.Other.Another.Name is not null"); + s.Close(); } [Test] ! [Ignore("Problems generating correct sql: http://jira.nhibernate.org:8080/browse/NH-83")] public void SubclassCollection() { + ISession s = sessions.OpenSession(); + SubMulti sm = new SubMulti(); + SubMulti sm1 = new SubMulti(); + SubMulti sm2 = new SubMulti(); + IList list = new ArrayList(); + IList anotherList = new ArrayList(); + sm.Children = list; + sm.MoreChildren = anotherList; + list.Add(sm1); + list.Add(sm2); + sm1.Parent = sm; + sm2.Parent = sm; + object id = s.Save(sm); + s.Save(sm1); + s.Save(sm2); + s.Flush(); + s.Close(); + + s = sessions.OpenSession(); + // TODO: I don't understand why h2.0.3 issues a select statement here + + // Invalid column "Name" - 83 + //Assert.AreEqual( 2, s.Find("select s from SubMulti as sm join sm.Children as s where s.Amount>-1 and s.Name is null").Count ); + Assert.AreEqual( 2, s.Find("select elements(sm.Children) from SubMulti as sm").Count ); + // Invalid column "Name" - 83 + //Assert.AreEqual( 1, s.Find("select distinct sm from SubMulti as sm join sm.Children as s where s.Amount>-1 and s.Name is null").Count ); + sm = (SubMulti)s.Load( typeof(SubMulti), id ); + Assert.AreEqual( 2, sm.Children.Count ); + + //TODO: code for a Filter here + + IEnumerator enumer = s.Enumerable("select distinct s from s in class SubMulti where s.MoreChildren[1].Amount < 1.0").GetEnumerator(); + // TODO: no rows returned here... + Assert.IsTrue( enumer.MoveNext() ); + Assert.AreSame( sm, enumer.MoveNext() ); + Assert.AreEqual( 2, sm.MoreChildren.Count ); + s.Delete(sm); + + foreach(object obj in sm.Children) + { + s.Delete(obj); + } + s.Flush(); + s.Close(); + + } [Test] public void CollectionOnly() { + ISession s = sessions.OpenSession(); + ITransaction t = s.BeginTransaction(); + Mono m = new Mono(); + long id = (long)s.Save(m); + t.Commit(); + s.Close(); + + s = sessions.OpenSession(); + t = s.BeginTransaction(); + s.Update(m, id); + s.Flush(); + m.Address = "foo bar"; + s.Flush(); + s.Delete(m); + t.Commit(); + s.Close(); } [Test] ! [Ignore("Problems generating correct sql: http://jira.nhibernate.org:8080/browse/NH-83")] public void Queries() { + ISession s = sessions.OpenSession(); + long id = 1L; + + if( (dialect is Dialect.SybaseDialect) || (dialect is Dialect.MsSql2000Dialect) ) + { + id = (long)s.Save( new TrivialClass() ); + } + else + { + s.Save( new TrivialClass(), id ); + } + + s.Flush(); + s.Close(); + + s = sessions.OpenSession(); + TrivialClass tc = (TrivialClass)s.Load( typeof(TrivialClass), id ); + s.Find("from s in class TrivialClass where s.id = 2"); + s.Find("select s.Count from s in class Simple"); + s.Find("from s in class LessSimple where s.Another.Name='name'"); + // bug 83 + //s.Find("from s in class LessSimple where s.YetAnother.Name='name'"); + //s.Find("from s in class LessSimple where s.YetAnother.Name='name' and s.YetAnother.Foo is null"); + s.Find("from s in class Simple where s.Count=1"); + s.Find("select s.Count from s in class Simple, ls in class LessSimple where ls.Another=s"); + s.Find("select ls.Bag.elements, ls.Set.elements from ls in class LessSimple"); + s.Enumerable("from s in class LessSimple"); + s.Enumerable("from s in class Simple"); + s.Delete(tc); + s.Flush(); + s.Close(); + } [Test] public void Constraints() { + ISession s = sessions.OpenSession(); + ITransaction t = s.BeginTransaction(); + SubMulti sm = new SubMulti(); + sm.Amount = 66.5f; + if( (dialect is Dialect.SybaseDialect) || (dialect is Dialect.MsSql2000Dialect) ) + { + s.Save(sm); + } + else + { + s.Save(sm, (long)2); + } + t.Commit(); + s.Close(); + + s = sessions.OpenSession(); + s.Delete( "from sm in class SubMulti" ); + t = s.BeginTransaction(); + t.Commit(); + s.Close(); } *************** *** 73,97 **** [Test] - [Ignore("Test not yet written")] public void MultiTableNativeId() { } [Test] - [Ignore("Test not yet written")] public void Collection() { } [Test] - [Ignore("Test not yet written")] public void OneToOne() { } [Test] - [Ignore("Test not yet written")] public void CollectionPointer() { } --- 202,292 ---- [Test] public void MultiTableNativeId() { + ISession s = sessions.OpenSession(); + ITransaction t = s.BeginTransaction(); + Multi multi = new Multi(); + multi.ExtraProp = "extra"; + object id = s.Save(multi); + Assert.IsNotNull(id); + s.Delete(multi); + t.Commit(); + s.Close(); } [Test] public void Collection() { + ISession s = sessions.OpenSession(); + ITransaction t = s.BeginTransaction(); + Multi multi1 = new Multi(); + multi1.ExtraProp = "extra1"; + Multi multi2 = new Multi(); + multi2.ExtraProp = "extra2"; + Po po = new Po(); + multi1.Po = po; + multi2.Po = po; + po.Set = new Hashtable(); + po.Set.Add( multi1, new object() ); + po.Set.Add( multi2, new object() ); + po.List = new ArrayList(); + po.List.Add( new SubMulti() ); + object id = s.Save(po); + Assert.IsNotNull(id); + t.Commit(); + s.Close(); + + s = sessions.OpenSession(); + t = s.BeginTransaction(); + po = (Po)s.Load( typeof(Po), id ); + Assert.AreEqual( 2, po.Set.Count ); + Assert.AreEqual( 1, po.List.Count ); + s.Delete(po); + Assert.AreEqual( 0, s.Find("from s in class Simple").Count ); + t.Commit(); + s.Close(); + } [Test] public void OneToOne() { + ISession s = sessions.OpenSession(); + LessSimple ls = new LessSimple(); + object id = s.Save(ls); + s.Flush(); + s.Close(); + + s = sessions.OpenSession(); + s.Load( typeof(LessSimple), id ); + s.Close(); + + s = sessions.OpenSession(); + s.Delete( s.Load( typeof(LessSimple), id ) ); + s.Flush(); + s.Close(); } [Test] public void CollectionPointer() { + ISession s = sessions.OpenSession(); + LessSimple ls = new LessSimple(); + IList list = new ArrayList(); + ls.Bag = list; + Simple simple = new Simple(); + object id = s.Save(ls); + s.Save(simple); + s.Flush(); + list.Add(simple); + s.Flush(); + s.Close(); + + s = sessions.OpenSession(); + ls = (LessSimple)s.Load( typeof(LessSimple), id ); + Assert.AreEqual( 1, ls.Bag.Count ); + s.Delete("from o in class System.Object"); + s.Flush(); + s.Close(); } |
From: Michael D. <mik...@us...> - 2004-08-01 15:01:34
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.DomainModel In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9987/NHibernate.DomainModel Modified Files: Multi.hbm.xml Log Message: Added column attribute to mappings so ddl would generate correctly. Index: Multi.hbm.xml =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.DomainModel/Multi.hbm.xml,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Multi.hbm.xml 9 Jul 2004 19:22:11 -0000 1.4 --- Multi.hbm.xml 1 Aug 2004 15:01:25 -0000 1.5 *************** *** 112,116 **** class="NHibernate.DomainModel.Multi, NHibernate.DomainModel" /> ! <many-to-one name="Po"/> <component --- 112,116 ---- class="NHibernate.DomainModel.Multi, NHibernate.DomainModel" /> ! <many-to-one name="Po" column="po"/> <component *************** *** 136,140 **** <one-to-many class="NHibernate.DomainModel.SubMulti, NHibernate.DomainModel"/> </bag> ! <many-to-one name="Parent"/> <list name="MoreChildren" lazy="true"> <key column="another_parent"/> --- 136,140 ---- <one-to-many class="NHibernate.DomainModel.SubMulti, NHibernate.DomainModel"/> </bag> ! <many-to-one name="Parent" column="parent" /> <list name="MoreChildren" lazy="true"> <key column="another_parent"/> |
From: Michael D. <mik...@us...> - 2004-08-01 15:00:28
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Persister In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9820/NHibernate/Persister Modified Files: NormalizedEntityPersister.cs Log Message: Fixed IndexOutOfRangeException with NormalizedEntityPersister for versioned entities. Index: NormalizedEntityPersister.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Persister/NormalizedEntityPersister.cs,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** NormalizedEntityPersister.cs 28 Jul 2004 03:56:49 -0000 1.21 --- NormalizedEntityPersister.cs 1 Aug 2004 15:00:18 -0000 1.22 *************** *** 1194,1201 **** if ( IsVersioned ) { ! VersionType.NullSafeSet( statements[0], version, IdentifierColumnNames.Length + 1 , session ); } ! for (int i=tableNames.Length-1; i>=0; i-- ) { // Do the key. The key is immutable so we can use the _current_ object state --- 1194,1202 ---- if ( IsVersioned ) { ! // don't need to add the 1 because the parameter indexes begin at 0, unlike jdbc's which begin at 1 ! VersionType.NullSafeSet( statements[0], version, IdentifierColumnNames.Length , session ); } ! for (int i=naturalOrderTableNames.Length-1; i>=0; i-- ) { // Do the key. The key is immutable so we can use the _current_ object state |
From: Michael D. <mik...@us...> - 2004-08-01 14:58:54
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9542/NHibernate/Util Modified Files: ReflectHelper.cs Log Message: Fixed bug that caused an " " to be parsed in hql and removed extra code in ReflectHelper.ClassForName that was catching that. Index: ReflectHelper.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Util/ReflectHelper.cs,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** ReflectHelper.cs 28 May 2004 11:49:05 -0000 1.11 --- ReflectHelper.cs 1 Aug 2004 14:58:46 -0000 1.12 *************** *** 142,146 **** /// <returns>The Type for the Class.</returns> public static System.Type ClassForName(string name) { - if (name == " ") return null; return System.Type.GetType(name, true); } --- 142,145 ---- |
From: Michael D. <mik...@us...> - 2004-08-01 14:58:54
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Hql In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9542/NHibernate/Hql Modified Files: QueryTranslator.cs Log Message: Fixed bug that caused an " " to be parsed in hql and removed extra code in ReflectHelper.ClassForName that was catching that. Index: QueryTranslator.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Hql/QueryTranslator.cs,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** QueryTranslator.cs 25 Jun 2004 20:41:10 -0000 1.32 --- QueryTranslator.cs 1 Aug 2004 14:58:45 -0000 1.33 *************** *** 989,993 **** string token = tokens[i]; ! if ( ParserHelper.IsWhitespace(token) || last==null ) { // scan for the next non-whitespace token --- 989,993 ---- string token = tokens[i]; ! if ( !ParserHelper.IsWhitespace(token) || last==null ) { // scan for the next non-whitespace token |
From: Michael D. <mik...@us...> - 2004-07-31 19:19:19
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8880/NHibernate.Test Modified Files: FumTest.cs Log Message: Implemented more tests. Index: FumTest.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/FumTest.cs,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** FumTest.cs 28 Jul 2004 03:29:21 -0000 1.9 --- FumTest.cs 31 Jul 2004 19:19:10 -0000 1.10 *************** *** 193,217 **** [Test] ! [Ignore("Test not yet written")] public void CompositeIDQuery() { } [Test] - [Ignore("Test not yet written")] public void CompositeIDCollections() { } [Test] - [Ignore("Test not yet written")] public void DeleteOwner() { } [Test] - [Ignore("Test not yet written")] public void CompositeIDs() { } --- 193,406 ---- [Test] ! [Ignore("ISession.Filter() not implemented. Everything else passes.")] public void CompositeIDQuery() { + ISession s = sessions.OpenSession(); + Fum fee = new Fum( FumTest.FumKey("fee", true) ); + fee.FumString = "fee"; + s.Save(fee); + Fum fi = new Fum( FumTest.FumKey("fi", true) ); + fi.FumString = "fi"; + short fiShort = fi.Id.Short; + s.Save(fi); + Fum fo = new Fum( FumTest.FumKey("fo", true) ); + fo.FumString = "fo"; + s.Save(fo); + Fum fum = new Fum( FumTest.FumKey("fum", true) ); + fum.FumString = "fum"; + s.Save(fum); + s.Flush(); + s.Close(); + + s = sessions.OpenSession(); + // Try to find the Fum object "fo" that we inserted searching by the string in the id + IList vList = s.Find("from fum in class NHibernate.DomainModel.Fum where fum.Id.String='fo'"); + Assert.AreEqual( 1, vList.Count, "find by composite key query (find fo object)" ); + fum = (Fum)vList[0]; + Assert.AreEqual( "fo", fum.Id.String, "find by composite key query (check fo object)" ); + + // Try to fnd the Fum object "fi" that we inserted by searching the date in the id + vList = s.Find("from fum in class NHibernate.DomainModel.Fum where fum.Id.Short = ?", fiShort, NHibernate.Int16 ); + Assert.AreEqual( 1, vList.Count, "find by composite key query (find fi object)" ); + fi = (Fum)vList[0]; + Assert.AreEqual( "fi", fi.Id.String, "find by composite key query (check fi object)" ); + + // make sure we can return all of the objects by searching by the date id + vList = s.Find("from fum in class NHibernate.DomainModel.Fum where fum.Id.Date <= ? and not fum.FumString='FRIEND'", DateTime.Now, NHibernate.Date); + Assert.AreEqual( 4, vList.Count, "find by composite key query with arguments" ); + s.Flush(); + s.Close(); + + s = sessions.OpenSession(); + Assert.IsTrue( s.Enumerable("select fum.Id.Short, fum.Id.Date, fum.Id.String from fum in class NHibernate.DomainModel.Fum").GetEnumerator().MoveNext() ); + Assert.IsTrue( s.Enumerable("select fum.Id from fum in class NHibernate.DomainModel.Fum").GetEnumerator().MoveNext() ); + + IQuery qu = s.CreateQuery("select fum.FumString, fum, fum.FumString, fum.Id.Date from fum in class NHibernate.DomainModel.Fum"); + Type.IType[] types = qu.ReturnTypes; + Assert.AreEqual( 4, types.Length ); + for( int k=0; k<types.Length; k++) + { + Assert.IsNotNull( types[k] ); + } + Assert.IsTrue( types[0] is Type.StringType ); + Assert.IsTrue( types[1] is Type.EntityType ); + Assert.IsTrue( types[2] is Type.StringType ); + Assert.IsTrue( types[3] is Type.DateTimeType ); + IEnumerator enumer = qu.Enumerable().GetEnumerator(); + int j = 0; + while( enumer.MoveNext() ) + { + j++; + Assert.IsTrue( ((object[])enumer.Current)[1] is Fum ); + } + Assert.AreEqual( 8, j, "iterate on composite key" ); + + //TODO: testing code for Filter() here + + enumer = s.Enumerable("from fum in class NHibernate.DomainModel.Fum where not fum.FumString='FRIEND'").GetEnumerator(); + int i = 0; + while( enumer.MoveNext() ) + { + fum = (Fum)enumer.Current; + s.Delete(fum); + i++; + } + Assert.AreEqual( 4, i, "iterate on composite key" ); + s.Flush(); + + s.Enumerable("from fu in class Fum, fo in class Fum where fu.Fo.Id.String = fo.Id.String and fo.FumString is not null"); + s.Find("from Fumm f1 inner join f1.Fum f2"); + s.Close(); } [Test] public void CompositeIDCollections() { + ISession s = sessions.OpenSession(); + Fum fum1 = new Fum( FumTest.FumKey("fum1") ); + Fum fum2 = new Fum( FumTest.FumKey("fum2") ); + fum1.FumString = "fee fo fi"; + fum2.FumString = "fee fo fi"; + s.Save(fum1); + s.Save(fum2); + Qux q = new Qux(); + s.Save(q); + IDictionary dict = new Hashtable(); + IList list = new ArrayList(); + dict.Add(fum1, new object() ); + dict.Add(fum2, new object() ); + list.Add(fum1); + q.Fums = dict; + q.MoreFums = list; + fum1.QuxArray = new Qux[] {q}; + s.Flush(); + s.Close(); + + s = sessions.OpenSession(); + q = (Qux)s.Load( typeof(Qux), q.Key ); + Assert.AreEqual( 2, q.Fums.Count, "collection of fums" ); + Assert.AreEqual( 1, q.MoreFums.Count, "collection of fums" ); + Assert.AreSame( q, ((Fum)q.MoreFums[0]).QuxArray[0], "unkeyed composite id collection" ); + IEnumerator enumer = q.Fums.Keys.GetEnumerator(); + enumer.MoveNext(); + s.Delete( (Fum)enumer.Current ); + enumer.MoveNext(); + s.Delete( (Fum)enumer.Current ); + s.Delete(q); + s.Flush(); + s.Close(); } [Test] public void DeleteOwner() { + ISession s = sessions.OpenSession(); + Qux q = new Qux(); + s.Save(q); + Fum f1 = new Fum( FumTest.FumKey("f1") ); + Fum f2 = new Fum( FumTest.FumKey("f2") ); + IDictionary dict = new Hashtable(); + dict.Add( f1, new object() ); + dict.Add( f2, new object() ); + IList list = new ArrayList(); + list.Add(f1); + list.Add(f2); + f1.FumString = "f1"; + f2.FumString = "f2"; + q.Fums = dict; + q.MoreFums = list; + s.Save(f1); + s.Save(f2); + s.Flush(); + s.Close(); + + s = sessions.OpenSession(); + ITransaction t = s.BeginTransaction(); + q = (Qux)s.Load( typeof(Qux), q.Key, LockMode.Upgrade ); + s.Lock( q, LockMode.Upgrade ); + s.Delete(q); + t.Commit(); + s.Close(); + + s = sessions.OpenSession(); + t = s.BeginTransaction(); + list = s.Find("from fum in class NHibernate.DomainModel.Fum where not fum.FumString='FRIEND'"); + Assert.AreEqual( 2, list.Count, "deleted owner" ); + s.Lock( list[0], LockMode.Upgrade ); + s.Lock( list[1], LockMode.Upgrade ); + foreach( object obj in list ) + { + s.Delete(obj); + } + t.Commit(); + s.Close(); + + } [Test] public void CompositeIDs() { + ISession s = sessions.OpenSession(); + Fo fo = Fo.NewFo(); + IDictionary props = new Hashtable(); + props["foo"] = "bar"; + props["bar"] = "foo"; + fo.Serial = props; + fo.Buf = System.Text.Encoding.ASCII.GetBytes("abcdefghij1`23%$*^*$*\n\t"); + s.Save( fo, FumTest.FumKey("an instance of fo") ); + s.Flush(); + props["x"] = "y"; + s.Flush(); + s.Close(); + + s = sessions.OpenSession(); + fo = (Fo)s.Load( typeof(Fo), FumTest.FumKey("an instance of fo") ); + props = (IDictionary)fo.Serial; + Assert.AreEqual( "bar", props["foo"] ); + Assert.AreEqual( "y", props["x"] ); + Assert.AreEqual( 'a', fo.Buf[0] ); + fo.Buf[1] = (byte)126; + s.Flush(); + s.Close(); + + s = sessions.OpenSession(); + fo = (Fo)s.Load( typeof(Fo), FumTest.FumKey("an instance of fo") ); + Assert.AreEqual( 126, fo.Buf[1] ); + IEnumerator enumer = s.Enumerable("from fo in class NHibernate.DomainModel.Fo where fo.id.String like 'an instance of fo'").GetEnumerator(); + Assert.IsTrue( enumer.MoveNext() ); + Assert.AreSame( fo, enumer.Current ); + s.Delete(fo); + s.Flush(); + try + { + s.Save( Fo.NewFo() ); + Assert.Fail("should not get here"); + } + catch(Exception e) + { + Assert.IsNotNull(e); + } + s.Close(); } *************** *** 219,228 **** [Test] ! [Ignore("Test not yet written")] public void KeyManyToOne() { ! } ! } } --- 408,461 ---- [Test] ! [Ignore("HQL can't parse a class named 'Order' - http://jira.nhibernate.org:8080/browse/NH-81, this test passes when changed to NHibernate.DomainModel")] public void KeyManyToOne() { ! ISession s = sessions.OpenSession(); ! Inner sup = new Inner(); ! InnerKey sid = new InnerKey(); ! sup.Dudu = "dudu"; ! sid.AKey = "a"; ! sid.BKey = "b"; ! sup.Id = sid; ! Middle m = new Middle(); ! MiddleKey mid = new MiddleKey(); ! mid.One = "one"; ! mid.Two = "two"; ! mid.Sup = sup; ! m.Id = mid; ! m.Bla = "bla"; ! Outer d = new Outer(); ! OuterKey did = new OuterKey(); ! did.Master = m; ! did.DetailId = "detail"; ! d.Id = did; ! d.Bubu = "bubu"; ! s.Save(sup); ! s.Save(m); ! s.Save(d); ! s.Flush(); ! s.Close(); ! s = sessions.OpenSession(); ! d = (Outer)s.Load( typeof(Outer), did ); ! Assert.AreEqual( "dudu", d.Id.Master.Id.Sup.Dudu ); ! s.Delete(d); ! s.Delete( d.Id.Master ); ! s.Save( d.Id.Master ); ! s.Save(d); ! s.Flush(); ! s.Close(); ! ! s = sessions.OpenSession(); ! d = (Outer)s.Find("from Outer o where o.id.DetailId=?", d.Id.DetailId, NHibernate.String)[0]; ! s.Find("from Outer o where o.Id.Master.Id.Sup.Dudu is not null"); ! s.Find("from Outer o where o.Id.Master.Bla = ''"); ! s.Find("from Outer o where o.Id.Master.Id.One = ''"); ! s.Delete(d); ! s.Delete(d.Id.Master); ! s.Delete(d.Id.Master.Id.Sup); ! s.Flush(); ! s.Close(); ! } } } |
From: Michael D. <mik...@us...> - 2004-07-31 19:19:04
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8791/NHibernate.Test Modified Files: App.config Log Message: Added sample config for Firebird. Index: App.config =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/App.config,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** App.config 23 Jul 2004 15:50:59 -0000 1.5 --- App.config 31 Jul 2004 19:18:55 -0000 1.6 *************** *** 7,17 **** <nhibernate> <add key="hibernate.connection.provider" value="NHibernate.Connection.DriverConnectionProvider" /> - - <!-- This is the SqlClient configuration --> - <add key="hibernate.dialect" --- 7,20 ---- <nhibernate> + <!-- + <add + key="hibernate.connection.pool_size" + value="2" + /> + --> <add key="hibernate.connection.provider" value="NHibernate.Connection.DriverConnectionProvider" /> <add key="hibernate.dialect" *************** *** 26,33 **** value="Server=localhost;initial catalog=nhibernate;Integrated Security=SSPI" /> ! <!-- This is the ByteFX.MySql.dll provider for MySql --> <!-- <add ! key="hibernate.connection.driver_class" value="NHibernate.Driver.ByteFXDataDriver" /> --- 29,44 ---- value="Server=localhost;initial catalog=nhibernate;Integrated Security=SSPI" /> ! <!-- <add ! key="hibernate.use_outer_join" ! value="false" ! /> ! --> ! ! <!-- This is the ByteFX.Data.dll provider for MySql --> ! <!-- ! <add ! key="hibernate.connection.driver_class" value="NHibernate.Driver.ByteFXDataDriver" /> *************** *** 42,46 **** --> ! </nhibernate> --- 53,73 ---- --> ! <!-- This is the Firebird configuration --> ! <!-- ! <add ! key="hibernate.dialect" ! value="NHibernate.Dialect.FirebirdDialect" ! /> ! <add ! key="hibernate.connection.driver_class" ! value="NHibernate.Driver.FirebirdDriver" ! /> ! <add ! key="hibernate.connection.connection_string" ! value="Data Source=localhost;Database=nhibernate;User=SYSDBA;password=masterkey;Charset=ISO8859_1;ServerType=0" ! ! /> ! --> ! </nhibernate> *************** *** 70,73 **** --- 97,107 ---- <appender-ref ref="rollingFile" /> </root> + + <!-- + <logger name="NHibernate.Impl.PreparerImpl"> + <level value="INFO" /> + </logger> + --> + </log4net> |
From: Michael D. <mik...@us...> - 2004-07-31 19:17:49
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Type In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8531/NHibernate/Type Modified Files: TypeFactory.cs Log Message: Removed commented out code. Index: TypeFactory.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Type/TypeFactory.cs,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** TypeFactory.cs 31 Jul 2004 19:16:44 -0000 1.34 --- TypeFactory.cs 31 Jul 2004 19:17:40 -0000 1.35 *************** *** 725,729 **** if(returnType==null) { ! returnType = new SerializableType( typeof(object) ); //GetSerializableType(255); AddToTypeOfName(key, returnType); } --- 725,729 ---- if(returnType==null) { ! returnType = new SerializableType( typeof(object) ); AddToTypeOfName(key, returnType); } *************** *** 759,763 **** if(returnType==null) { ! returnType = new SerializableType(serializableType); //GetSerializableType(serializableType, 255); AddToTypeOfName(key, returnType); } --- 759,763 ---- if(returnType==null) { ! returnType = new SerializableType(serializableType); AddToTypeOfName(key, returnType); } |