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-16 05:15:20
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31507 Modified Files: FooBarTest.cs MasterDetailTest.cs PerformanceTest.cs Log Message: Modified tests to get ride of variable not used compiler warnings. Index: PerformanceTest.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/PerformanceTest.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** PerformanceTest.cs 6 Aug 2004 14:50:34 -0000 1.7 --- PerformanceTest.cs 16 Aug 2004 05:15:10 -0000 1.8 *************** *** 171,177 **** // how many times we flush! Assert.IsTrue( s.Delete("from s in class NHibernate.DomainModel.Simple") == N); ! s.Flush(); t.Commit(); --- 171,185 ---- // how many times we flush! + // t.Commit(); + // + // t = s.BeginTransaction(); + // + // for(int i = 0; i < N; i++) + // { + // s.Delete(simples[i]); + // } Assert.IsTrue( s.Delete("from s in class NHibernate.DomainModel.Simple") == N); ! //s.Flush(); t.Commit(); Index: FooBarTest.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/FooBarTest.cs,v retrieving revision 1.57 retrieving revision 1.58 diff -C2 -d -r1.57 -r1.58 *** FooBarTest.cs 14 Aug 2004 14:56:03 -0000 1.57 --- FooBarTest.cs 16 Aug 2004 05:15:10 -0000 1.58 *************** *** 2473,2476 **** --- 2473,2477 ---- catch (Exception e) { + Assert.IsNotNull(e); //getting ride of 'e' is never used compile warning t.Rollback(); } *************** *** 2970,2973 **** --- 2971,2975 ---- catch(ObjectDeletedException ode) { + Assert.IsNotNull(ode); //getting ride of 'ode' is never used compile warning err = true; } *************** *** 2984,2987 **** --- 2986,2990 ---- catch(LazyInitializationException lie) { + Assert.IsNotNull(lie); //getting ride of 'lie' is never used compile warning err = true; } *************** *** 3001,3004 **** --- 3004,3008 ---- catch(ObjectDeletedException ode) { + Assert.IsNotNull(ode); //getting ride of 'ode' is never used compile warning err = true; } Index: MasterDetailTest.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/MasterDetailTest.cs,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** MasterDetailTest.cs 14 Aug 2004 14:57:48 -0000 1.10 --- MasterDetailTest.cs 16 Aug 2004 05:15:10 -0000 1.11 *************** *** 372,376 **** catch (Exception e) { ! Assert.IsTrue( e is Exception, "just getting rid of a compiler warning." ); } } --- 372,376 ---- catch (Exception e) { ! Assert.IsNotNull(e); //getting ride of 'e' is never used compile warning } } *************** *** 701,704 **** --- 701,705 ---- catch(ObjectNotFoundException onfe) { + Assert.IsNotNull(onfe); //getting ride of 'onfe' is never used compile warning none = true; } |
From: Michael D. <mik...@us...> - 2004-08-16 05:15:19
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/NHSpecificTest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31507/NHSpecificTest Modified Files: BasicClassFixture.cs ClassWithCompositeIdFixture.cs UnsavedValueFixture.cs Log Message: Modified tests to get ride of variable not used compiler warnings. Index: ClassWithCompositeIdFixture.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/NHSpecificTest/ClassWithCompositeIdFixture.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ClassWithCompositeIdFixture.cs 17 Jun 2004 21:18:57 -0000 1.3 --- ClassWithCompositeIdFixture.cs 16 Aug 2004 05:15:10 -0000 1.4 *************** *** 140,143 **** --- 140,144 ---- { // I expect this to be thrown because the object no longer exists... + Assert.IsNotNull(onfe); //getting ride of 'onfe' is never used compile warning } Index: BasicClassFixture.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/NHSpecificTest/BasicClassFixture.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** BasicClassFixture.cs 29 Jun 2004 04:30:16 -0000 1.2 --- BasicClassFixture.cs 16 Aug 2004 05:15:10 -0000 1.3 *************** *** 793,796 **** --- 793,797 ---- { // I expect this to be thrown because the object no longer exists... + Assert.IsNotNull(onfe); //getting ride of 'onfe' is never used compile warning } Index: UnsavedValueFixture.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/NHSpecificTest/UnsavedValueFixture.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** UnsavedValueFixture.cs 9 Jun 2004 01:06:22 -0000 1.1 --- UnsavedValueFixture.cs 16 Aug 2004 05:15:10 -0000 1.2 *************** *** 101,104 **** --- 101,105 ---- { // do nothing it was expected + Assert.IsNotNull(onfe); //getting ride of 'onfe' is never used compile warning } |
From: Michael D. <mik...@us...> - 2004-08-16 05:14:49
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31432 Modified Files: NHibernate.Test-1.1.csproj Log Message: Added tests for new functionallity with SqlStrings. Index: NHibernate.Test-1.1.csproj =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/NHibernate.Test-1.1.csproj,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** NHibernate.Test-1.1.csproj 2 Aug 2004 04:30:36 -0000 1.32 --- NHibernate.Test-1.1.csproj 16 Aug 2004 05:14:40 -0000 1.33 *************** *** 377,380 **** --- 377,390 ---- /> <File + RelPath = "SqlCommandTest\SqlStringBuilderFixture.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "SqlCommandTest\SqlStringFixture.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "SqlCommandTest\SqlStringParameterFixture.cs" SubType = "Code" |
From: Michael D. <mik...@us...> - 2004-08-16 05:14:31
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/SqlCommandTest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31376/SqlCommandTest Added Files: SqlStringBuilderFixture.cs SqlStringFixture.cs Log Message: Added tests for new functionallity with SqlStrings. --- NEW FILE: SqlStringBuilderFixture.cs --- using System; using NHibernate.SqlCommand; using NUnit.Framework; namespace NHibernate.Test.SqlCommandTest { /// <summary> /// Summary description for SqlStringBuilderFixture. /// </summary> [TestFixture] public class SqlStringBuilderFixture { [Test] public void InsertAndAdd() { SqlStringBuilder builder = new SqlStringBuilder(); builder.Add("col1, col2 "); builder.Insert( 0, "select "); builder.Add("from table "); Assert.AreEqual( "select col1, col2 from table ", builder.ToSqlString().ToString() ); } } } --- NEW FILE: SqlStringFixture.cs --- using System; using NHibernate.SqlCommand; using NUnit.Framework; namespace NHibernate.Test.SqlCommandTest { /// <summary> /// Summary description for SqlStringFixture. /// </summary> [TestFixture] public class SqlStringFixture { [Test] public void Append() { SqlString sql = new SqlString( new string[] { "select", " from table" } ); SqlString postAppendSql = sql.Append(" where A=B" ); Assert.IsFalse( sql==postAppendSql, "should be a new object" ); Assert.AreEqual( 3, postAppendSql.SqlParts.Length ); sql = postAppendSql; postAppendSql = sql.Append( new SqlString(" and C=D") ); Assert.AreEqual(4, postAppendSql.SqlParts.Length ); Assert.AreEqual( "select from table where A=B and C=D", postAppendSql.ToString() ); } } } |
From: Michael D. <mik...@us...> - 2004-08-16 05:11:19
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Type In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30967/Type Modified Files: PersistentCollectionType.cs Log Message: Added clarification to why a block of code was commented out. Index: PersistentCollectionType.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Type/PersistentCollectionType.cs,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** PersistentCollectionType.cs 1 Jun 2004 01:36:11 -0000 1.12 --- PersistentCollectionType.cs 16 Aug 2004 05:11:08 -0000 1.13 *************** *** 109,112 **** --- 109,113 ---- public override object Disassemble(object value, ISessionImplementor session) { return null; + // commented out in h2.0.3 also // if (value==null) { // return null; |
From: Michael D. <mik...@us...> - 2004-08-16 05:10:28
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Connection In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30860/Connection Modified Files: ConnectionProviderFactory.cs Log Message: Removed some code I did not realize was still commented out. Index: ConnectionProviderFactory.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Connection/ConnectionProviderFactory.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ConnectionProviderFactory.cs 24 Jul 2004 20:43:22 -0000 1.5 --- ConnectionProviderFactory.cs 16 Aug 2004 05:10:20 -0000 1.6 *************** *** 40,46 **** else { ! throw new NotImplementedException("We have not implemented user supplied connections yet."); ! // connections = new UserSuppliedConnectionProvider(); ! // connections = new SqlServerConnectionProvider(); } connections.Configure(settings); --- 40,44 ---- else { ! connections = new UserSuppliedConnectionProvider(); } connections.Configure(settings); |
From: Michael D. <mik...@us...> - 2004-08-16 05:09:49
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30647/Impl Modified Files: SessionFactoryImpl.cs Log Message: Modified the contents of the classPersistersByName to have both the FullClassname and AssemblyQualifiedName. Implemented the FilterCacheKey and QueryCacheKey. Index: SessionFactoryImpl.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl/SessionFactoryImpl.cs,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** SessionFactoryImpl.cs 14 Aug 2004 14:54:16 -0000 1.25 --- SessionFactoryImpl.cs 16 Aug 2004 05:09:30 -0000 1.26 *************** *** 190,194 **** --- 190,204 ---- cp = PersisterFactory.Create(model, this); classPersisters[model.PersistentClazz] = cp; + + // Adds the "Namespace.ClassName" (FullClassname) as a lookup to get to the Persiter. + // Most of the internals of NHibernate use this method to get to the Persister since + // Model.Name is used in so many places. It would be nice to fix it up to be Model.TypeName + // instead of just FullClassname classPersistersByName[model.Name] = cp ; + + // Add in the AssemblyQualifiedName (includes version) as a lookup to get to the Persister. + // In HQL the Imports are used to get from the Classname to the Persister. The + // Imports provide the ability to jump from the Classname to the AssemblyQualifiedName. + classPersistersByName[model.PersistentClazz.AssemblyQualifiedName] = cp; } *************** *** 241,273 **** [NonSerialized] private readonly IDictionary softQueryCache = new Hashtable(); //TODO: make soft reference map ! //TODO: All ! private static readonly QueryCacheKeyFactory QueryKeyFactory; ! private static readonly FilterCacheKeyFactory FilterKeyFactory; static SessionFactoryImpl() { ! /* ! * KeyFactory is a CGLIB item. ! QueryKeyFactory = (QueryCacheKeyFactory) KeyFactory.Create(QueryCacheKeyFactory.GetType(), QueryCacheKeyFactory......); ! FilterKeyFactory = (FilterCacheKeyFactory) KeyFactory.Create( ! FilterCacheKeyFactory.class, FilterCacheKeyFactory.class.getClassLoader() ); ! */ ! ! QueryKeyFactory = null; ! FilterKeyFactory = null; } ! ! interface QueryCacheKeyFactory { ! // will not recalculate hashKey for constant queries ! object NewInstance(string query, bool scalar); } ! interface FilterCacheKeyFactory { ! // will not recalculate hashKey for constant queries ! object NewInstance(string role, string query, bool scalar); } [MethodImpl(MethodImplOptions.Synchronized)] --- 251,374 ---- [NonSerialized] private readonly IDictionary softQueryCache = new Hashtable(); //TODO: make soft reference map ! static SessionFactoryImpl() { ! // used to do some CGLIB stuff in here for QueryKeyFactory and FilterKeyFactory } ! /// <summary> ! /// A class that can be used as a Key in a Hashtable for ! /// a Query Cache. ! /// </summary> ! private class QueryCacheKey { ! private string _query; ! private bool _scalar; ! ! internal QueryCacheKey(string query, bool scalar) ! { ! _query = query; ! _scalar = scalar; ! } ! ! public string Query ! { ! get { return _query; } ! } ! ! public bool Scalar ! { ! get { return _scalar; } ! } ! ! #region System.Object Members ! ! public override bool Equals(object obj) ! { ! QueryCacheKey other = obj as QueryCacheKey; ! if( other==null) return false; ! ! return Equals(other); ! } ! ! public bool Equals(QueryCacheKey obj) ! { ! return this.Query.Equals(obj.Query) && this.Scalar==obj.Scalar; ! } ! ! public override int GetHashCode() ! { ! unchecked ! { ! return this.Query.GetHashCode() + this.Scalar.GetHashCode(); ! } ! } ! ! #endregion ! ! } ! /// <summary> ! /// A class that can be used as a Key in a Hashtable for ! /// a Query Cache. ! /// </summary> ! private class FilterCacheKey { ! private string _role; ! private string _query; ! private bool _scalar; ! ! internal FilterCacheKey(string role, string query, bool scalar) ! { ! _role = role; ! _query = query; ! _scalar = scalar; ! } ! ! public string Role ! { ! get { return _role; } ! } ! ! public string Query ! { ! get { return _query; } ! } ! ! public bool Scalar ! { ! get { return _scalar; } ! } ! ! #region System.Object Members ! ! public override bool Equals(object obj) ! { ! FilterCacheKey other = obj as FilterCacheKey; ! if( other==null) return false; ! ! return Equals(other); ! } ! ! public bool Equals(FilterCacheKey obj) ! { ! return this.Role.Equals(obj.Role) && this.Query.Equals(obj.Query) && this.Scalar==obj.Scalar; ! } ! ! public override int GetHashCode() ! { ! unchecked ! { ! return this.Role.GetHashCode() + this.Query.GetHashCode() + this.Scalar.GetHashCode(); ! } ! } ! ! #endregion ! ! } + [MethodImpl(MethodImplOptions.Synchronized)] *************** *** 304,311 **** } - //TODO: h2.0.3 synch private QueryTranslator GetQuery(string query, bool shallow) { ! /*object cacheKey = QueryKeyFactory.NewInstance(query, shallow); // have to be careful to ensure that if the JVM does out-of-order execution --- 405,411 ---- } private QueryTranslator GetQuery(string query, bool shallow) { ! QueryCacheKey cacheKey = new QueryCacheKey(query, shallow); // have to be careful to ensure that if the JVM does out-of-order execution *************** *** 315,324 **** QueryTranslator q = (QueryTranslator) Get(cacheKey); ! if ( q==null) { ! q = new QueryTranslator(); Put(cacheKey, q); } ! */ ! QueryTranslator q = new QueryTranslator(dialect); q.Compile(this, query, querySubstitutions, shallow); --- 415,424 ---- QueryTranslator q = (QueryTranslator) Get(cacheKey); ! if ( q==null) ! { ! q = new QueryTranslator(dialect); Put(cacheKey, q); } ! q.Compile(this, query, querySubstitutions, shallow); *************** *** 328,340 **** public FilterTranslator GetFilter(string query, string collectionRole, bool scalar) { ! // object cacheKey = FilterKeyFactory.NewInstance(collectionRole, query, scalar ); ! // ! // FilterTranslator q = (FilterTranslator) Get(cacheKey); ! // if ( q==null ) ! // { ! // q = new FilterTranslator(dialect); ! // Put(cacheKey, q); ! // } ! FilterTranslator q = new FilterTranslator(dialect); q.Compile(collectionRole, this, query, querySubstitutions, scalar); --- 428,440 ---- public FilterTranslator GetFilter(string query, string collectionRole, bool scalar) { ! FilterCacheKey cacheKey = new FilterCacheKey( collectionRole, query, scalar ); ! ! FilterTranslator q = (FilterTranslator) Get(cacheKey); ! if ( q==null ) ! { ! q = new FilterTranslator(dialect); ! Put(cacheKey, q); ! } ! q.Compile(collectionRole, this, query, querySubstitutions, scalar); *************** *** 397,401 **** //(IClassPersister) was replaced by as IClassPersister result = classPersistersByName[className] as IClassPersister; ! //if ( result==null) throw new MappingException( "No persister for: " + className ); return result; } --- 497,503 ---- //(IClassPersister) was replaced by as IClassPersister result = classPersistersByName[className] as IClassPersister; ! //TODO: not throwing this exception results in a 50% perf gain with hql - not sure ! // where else this code is being used and expecting an exception... ! // if ( result==null) throw new MappingException( "No persister for: " + className ); return result; } |
From: Michael D. <mik...@us...> - 2004-08-16 05:07:57
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Cfg In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30426/Cfg Modified Files: Binder.cs Mappings.cs Log Message: Modified the imports to map a class name and fullyqualifiedname to assemblyqualifiedname. Index: Mappings.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Cfg/Mappings.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Mappings.cs 30 Apr 2004 08:20:50 -0000 1.6 --- Mappings.cs 16 Aug 2004 05:07:45 -0000 1.7 *************** *** 56,63 **** } public void AddImport(string className, string rename) { ! if ( imports.Contains(rename) && (string)imports[rename] != className) throw new MappingException("duplicate import: " + rename); imports.Add(rename, className); } --- 56,71 ---- } + /// <summary> + /// Adds an import to allow for the full class name <c>Namespace.BusClass</c> + /// to be referenced as <c>BusClass</c> or some other name in Hql. + /// </summary> + /// <param name="className">The name of the class that is being renamed.</param> + /// <param name="rename">The new name to use in Hql for the class.</param> public void AddImport(string className, string rename) { ! if ( imports.Contains(rename) && (string)imports[rename] != className) ! { throw new MappingException("duplicate import: " + rename); + } imports.Add(rename, className); } Index: Binder.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Cfg/Binder.cs,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** Binder.cs 13 Aug 2004 18:53:39 -0000 1.26 --- Binder.cs 16 Aug 2004 05:07:45 -0000 1.27 *************** *** 1,5 **** using System; - using System.Xml; using System.Collections; using NHibernate.Engine; using NHibernate.Loader; --- 1,7 ---- using System; using System.Collections; + using System.Text; + using System.Xml; + using NHibernate.Engine; using NHibernate.Loader; *************** *** 8,12 **** using NHibernate.Type; using NHibernate.Util; - using System.Text; namespace NHibernate.Cfg { --- 10,13 ---- *************** *** 67,73 **** //import if (mapping.IsAutoImport) { ! mapping.AddImport( StringHelper.GetFullClassname(className), StringHelper.GetClassname(className) ); } } --- 68,83 ---- //import + + // we automattically want to add an import of the Assembly Qualified Name (includes version, + // culture, public-key) to the className supplied in the hbm.xml file. The most common use-case + // will have it contain the "FullClassname, AssemblyName", it might contain version, culture, + // public key, etc...) but should not assume it does. + mapping.AddImport( model.PersistentClazz.AssemblyQualifiedName, StringHelper.GetFullClassname(className) ); + + // if we are supposed to auto-import the Class then add an import to get from the Classname + // to the Assembly Qualified Class Name if (mapping.IsAutoImport) { ! mapping.AddImport( model.PersistentClazz.AssemblyQualifiedName, StringHelper.GetClassname(className) ); } } |
From: Michael D. <mik...@us...> - 2004-08-14 20:59:44
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16511/Util Modified Files: SequencedHashMap.cs Log Message: Made public methods virtual to help Kevin with DNCache. http://jira.nhibernate.org:8080/browse/NH-97 Index: SequencedHashMap.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Util/SequencedHashMap.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** SequencedHashMap.cs 9 Aug 2004 03:18:49 -0000 1.6 --- SequencedHashMap.cs 14 Aug 2004 20:59:35 -0000 1.7 *************** *** 246,260 **** #region System.Collections.IDictionary Members ! public bool IsFixedSize { get { return false; } } ! public bool IsReadOnly { get { return false; } } ! public object this [ object o ] { get --- 246,260 ---- #region System.Collections.IDictionary Members ! public virtual bool IsFixedSize { get { return false; } } ! public virtual bool IsReadOnly { get { return false; } } ! public virtual object this [ object o ] { get *************** *** 285,304 **** } ! public ICollection Keys { get { return new KeyCollection(this); } } ! public ICollection Values { get { return new ValuesCollection(this); } } ! public void Add(object key, object value) { this[key] = value; } ! public void Clear() { _modCount++; --- 285,304 ---- } ! public virtual ICollection Keys { get { return new KeyCollection(this); } } ! public virtual ICollection Values { get { return new ValuesCollection(this); } } ! public virtual void Add(object key, object value) { this[key] = value; } ! public virtual void Clear() { _modCount++; *************** *** 310,324 **** } ! public bool Contains(object key) { return ContainsKey(key); } ! public IDictionaryEnumerator GetEnumerator() { return new OrderedEnumerator(this, ReturnType.ReturnEntry); } ! public void Remove(object key) { RemoveImpl(key); --- 310,324 ---- } ! public virtual bool Contains(object key) { return ContainsKey(key); } ! public virtual IDictionaryEnumerator GetEnumerator() { return new OrderedEnumerator(this, ReturnType.ReturnEntry); } ! public virtual void Remove(object key) { RemoveImpl(key); *************** *** 329,348 **** #region System.Collections.ICollection Members ! public int Count { get { return _entries.Count; } } ! public bool IsSynchronized { get { return false; } } ! public object SyncRoot { get { return this; } } ! public void CopyTo(Array array, int index) { foreach(DictionaryEntry de in this) --- 329,348 ---- #region System.Collections.ICollection Members ! public virtual int Count { get { return _entries.Count; } } ! public virtual bool IsSynchronized { get { return false; } } ! public virtual object SyncRoot { get { return this; } } ! public virtual void CopyTo(Array array, int index) { foreach(DictionaryEntry de in this) *************** *** 370,379 **** } ! public bool ContainsKey(object key) { return _entries.ContainsKey(key); } ! public bool ContainsValue(object value) { if (value == null) --- 370,379 ---- } ! public virtual bool ContainsKey(object key) { return _entries.ContainsKey(key); } ! public virtual bool ContainsValue(object value) { if (value == null) *************** *** 400,409 **** } ! public object FirstKey { get { return (First==null) ? null : First.Key; } } ! public object FirstValue { get { return (First==null) ? null : First.Value; } --- 400,409 ---- } ! public virtual object FirstKey { get { return (First==null) ? null : First.Key; } } ! public virtual object FirstValue { get { return (First==null) ? null : First.Value; } *************** *** 415,424 **** } ! public object LastKey { get { return (Last==null) ? null : Last.Key; } } ! public object LastValue { get { return (Last==null) ? null : Last.Value; } --- 415,424 ---- } ! public virtual object LastKey { get { return (Last==null) ? null : Last.Key; } } ! public virtual object LastValue { get { return (Last==null) ? null : Last.Value; } |
From: Michael D. <mik...@us...> - 2004-08-14 14:57:57
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26350/nhibernate/src/NHibernate.Test Modified Files: FumTest.cs MasterDetailTest.cs Log Message: Implemented more tests. These tests still contain some probs with Filter. Index: MasterDetailTest.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/MasterDetailTest.cs,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** MasterDetailTest.cs 9 Aug 2004 03:40:41 -0000 1.9 --- MasterDetailTest.cs 14 Aug 2004 14:57:48 -0000 1.10 *************** *** 20,24 **** ExportSchema(new string[] { "MasterDetail.hbm.xml", ! //"Custom.hbm.xml", "Category.hbm.xml", "INameable.hbm.xml", --- 20,24 ---- ExportSchema(new string[] { "MasterDetail.hbm.xml", ! "Custom.hbm.xml", "Category.hbm.xml", "INameable.hbm.xml", *************** *** 191,195 **** //http://jira.nhibernate.org:8080/browse/NH-79 ! /* s = sessions.OpenSession(); t = s.BeginTransaction(); --- 191,195 ---- //http://jira.nhibernate.org:8080/browse/NH-79 ! /* s = sessions.OpenSession(); t = s.BeginTransaction(); *************** *** 206,214 **** // rest of the test depends on ISession.Filter() working } [Test] - [Ignore("FilterKeyFactory is null so code for test is not complete. http://jira.nhibernate.org:8080/browse/NH-80")] public void IncomingOutgoing() { --- 206,249 ---- // rest of the test depends on ISession.Filter() working + s = sessions.OpenSession(); + t = s.BeginTransaction(); + Detail dd = (Detail)s.Load( typeof(Detail), did ); + master = dd.Master; + Assert.IsTrue( master.Details.Contains(dd), "detail-master" ); + Assert.AreEqual( 2, s.Filter( master.Details, "order by this.I desc").Count ); + Assert.AreEqual( 2, s.Filter( master.Details, "select this where this.id > -1").Count ); + /* + * TODO: Filter is not working well... + IQuery q = s.CreateFilter( master.Details, "where this.id > :id" ); + q.SetInt32("id", -1); + Assert.AreEqual( 2, q.List().Count ); + + q = s.CreateFilter( master.Details, "where this.id > :id1 and this.id < :id2" ); + q.SetInt32("id1", -1); + q.SetInt32("id2", 99999999); + Assert.AreEqual( 2, q.List().Count ); + q.SetInt32("id2", -1); + Assert.AreEqual( 0, q.List().Count ); + + q = s.CreateFilter( master.Details, "where this.id in (:ids)" ); + list = new ArrayList(); + list.Add(did); + list.Add( (long)-1 ); + q.SetParameterList("ids", list); + + Assert.AreEqual( 1, q.List().Count ); + Assert.IsTrue( q.Enumerable().GetEnumerator().MoveNext() ); + */ + Assert.AreEqual( 2, s.Filter( master.Details, "where this.id > -1").Count ); + Assert.AreEqual( 2, s.Filter( master.Details, "select this.Master where this.id > -1").Count ); + Assert.AreEqual( 2, s.Filter( master.Details, "select m from m in class Master where this.id > -1 and this.Master=m").Count ); + Assert.AreEqual( 0, s.Filter( master.Incoming.Keys, "where this.id > -1 and this.Name is not null").Count ); + + + } [Test] public void IncomingOutgoing() { *************** *** 228,236 **** object m1id = s.GetIdentifier(master1); - //TODO: Filter's are not working because FilterKeyFactory is null. Assert.AreEqual( 2, s.Filter(master1.Incoming, "where this.id > 0 and this.Name is not null").Count ); s.Flush(); s.Close(); } --- 263,285 ---- object m1id = s.GetIdentifier(master1); Assert.AreEqual( 2, s.Filter(master1.Incoming, "where this.id > 0 and this.Name is not null").Count ); s.Flush(); s.Close(); + s = sessions.OpenSession(); + master1 = (Master)s.Load( typeof(Master), m1id ); + int i = 0; + foreach( Master m in master1.Incoming.Keys ) + { + Assert.AreEqual( 1, m.Outgoing.Count, "outgoing" ); + Assert.IsTrue( m.Outgoing.Contains(master1), "outgoing" ); + s.Delete(m); + i++; + } + + Assert.AreEqual( 2, i, "incoming-outgoing" ); + s.Delete(master1); + s.Flush(); + s.Close(); } *************** *** 619,625 **** [Test] - [Ignore("Test not written yet.")] public void CustomPersister() { } --- 668,709 ---- [Test] public void CustomPersister() { + ISession s = sessions.OpenSession(); + Custom c = new Custom(); + c.Name = "foo"; + c.Id = 100; + long id = (long)s.Save(c); + Assert.AreSame( c, s.Load( typeof(Custom), id ) ); + s.Flush(); + s.Close(); + + s = sessions.OpenSession(); + c = (Custom)s.Load( typeof(Custom), id ); + Assert.AreEqual( "foo", c.Name ); + c.Name = "bar"; + s.Flush(); + s.Close(); + + s = sessions.OpenSession(); + c = (Custom)s.Load( typeof(Custom), id ); + Assert.AreEqual( "bar", c.Name ); + s.Delete(c); + s.Flush(); + s.Close(); + + s = sessions.OpenSession(); + bool none = false; + try + { + s.Load( typeof(Custom), id ); + } + catch(ObjectNotFoundException onfe) + { + none = true; + } + + Assert.IsTrue(none); + s.Close(); } Index: FumTest.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/FumTest.cs,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** FumTest.cs 1 Aug 2004 22:12:45 -0000 1.11 --- FumTest.cs 14 Aug 2004 14:57:48 -0000 1.12 *************** *** 193,197 **** [Test] ! [Ignore("ISession.Filter() not implemented. Everything else passes. http://jira.nhibernate.org:8080/browse/NH-80")] public void CompositeIDQuery() { --- 193,197 ---- [Test] ! [Ignore("Filter() and multi-column Types. Everything else passes. http://jira.nhibernate.org:8080/browse/NH-96")] public void CompositeIDQuery() { *************** *** 256,260 **** 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(); --- 256,266 ---- Assert.AreEqual( 8, j, "iterate on composite key" ); ! fum = (Fum)s.Load( typeof(Fum), fum.Id ); ! //TODO: http://jira.nhibernate.org:8080/browse/NH-96 bug is here ! s.Filter( fum.QuxArray, "where this.Foo is null" ); ! s.Filter( fum.QuxArray, "where this.Foo.id = ?", "fooid", NHibernate.String ); ! IQuery f = s.CreateFilter( fum.QuxArray, "where this.Foo.id = :fooId" ); ! f.SetString("fooId", "abc"); ! Assert.IsFalse( f.Enumerable().GetEnumerator().MoveNext() ); enumer = s.Enumerable("from fum in class NHibernate.DomainModel.Fum where not fum.FumString='FRIEND'").GetEnumerator(); |
From: Michael D. <mik...@us...> - 2004-08-14 14:56:32
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26171/nhibernate/src/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.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** MultiTableTest.cs 1 Aug 2004 21:59:33 -0000 1.4 --- MultiTableTest.cs 14 Aug 2004 14:56:23 -0000 1.5 *************** *** 40,44 **** [Test] - [Ignore("Filter Not Working http://jira.nhibernate.org:8080/browse/NH-80")] public void SubclassCollection() { --- 40,43 ---- *************** *** 72,76 **** 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(); --- 71,82 ---- Assert.AreEqual( 2, sm.Children.Count ); ! ICollection filterColl = s.Filter( sm.MoreChildren, "select count(*) where this.Amount>-1 and this.Name is null"); ! foreach(object obj in filterColl) ! { ! Assert.AreEqual( 2, obj ); ! // only want the first one ! break; ! } ! IEnumerator enumer = s.Enumerable("select distinct s from s in class SubMulti where s.MoreChildren[1].Amount < 1.0").GetEnumerator(); |
From: Michael D. <mik...@us...> - 2004-08-14 14:56:12
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26095/nhibernate/src/NHibernate.Test Modified Files: FooBarTest.cs Log Message: Implemented more tests. Index: FooBarTest.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/FooBarTest.cs,v retrieving revision 1.56 retrieving revision 1.57 diff -C2 -d -r1.56 -r1.57 *** FooBarTest.cs 13 Aug 2004 18:57:24 -0000 1.56 --- FooBarTest.cs 14 Aug 2004 14:56:03 -0000 1.57 *************** *** 461,467 **** [Test] - [Ignore("Test not written yet.")] public void Custom() { } --- 461,494 ---- [Test] public void Custom() { + GlarchProxy g = new Glarch(); + Multiplicity m = new Multiplicity(); + m.count = 12; + m.glarch = (Glarch)g; + g.Multiple = m; + + ISession s = sessions.OpenSession(); + object gid = s.Save(g); + s.Flush(); + s.Close(); + + s = sessions.OpenSession(); + g = (Glarch)s.Find("from Glarch g where g.Multiple.glarch=g and g.Multiple.count=12")[0]; + Assert.IsNotNull( g.Multiple ); + Assert.AreEqual( 12, g.Multiple.count ); + Assert.AreSame( g, g.Multiple.glarch ); + s.Flush(); + s.Close(); + + s = sessions.OpenSession(); + g = (GlarchProxy)s.Load( typeof(Glarch), gid ); + Assert.IsNotNull(g.Multiple); + Assert.AreEqual( 12, g.Multiple.count ); + Assert.AreSame( g, g.Multiple.glarch ); + s.Delete(g); + s.Flush(); + s.Close(); + } |
From: Michael D. <mik...@us...> - 2004-08-14 14:55:01
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Loader In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25972/nhibernate/src/NHibernate/Loader Modified Files: Loader.cs Log Message: Added HACK for FilterTranslator until everything converted to SqlString Index: Loader.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Loader/Loader.cs,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** Loader.cs 25 Jun 2004 20:33:02 -0000 1.24 --- Loader.cs 14 Aug 2004 14:54:53 -0000 1.25 *************** *** 177,181 **** //HACK: this is here until we get every loader moved over to commands... IDbCommand st = null; ! if(this.GetType()!=typeof(Hql.QueryTranslator)) { st = PrepareCommand( --- 177,181 ---- //HACK: this is here until we get every loader moved over to commands... IDbCommand st = null; ! if( this.GetType()!=typeof(Hql.QueryTranslator) && this.GetType()!=typeof(Hql.FilterTranslator) ) { st = PrepareCommand( |
From: Michael D. <mik...@us...> - 2004-08-14 14:54:26
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25914/nhibernate/src/NHibernate/Impl Modified Files: SessionFactoryImpl.cs Log Message: commented out the cache for Filters because it is based on cglib. Filters kind of work now but are always being rebuilt. Index: SessionFactoryImpl.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl/SessionFactoryImpl.cs,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** SessionFactoryImpl.cs 9 Aug 2004 03:51:23 -0000 1.24 --- SessionFactoryImpl.cs 14 Aug 2004 14:54:16 -0000 1.25 *************** *** 328,339 **** public FilterTranslator GetFilter(string query, string collectionRole, bool scalar) { ! object cacheKey = FilterKeyFactory.NewInstance(collectionRole, query, scalar ); ! ! FilterTranslator q = (FilterTranslator) Get(cacheKey); ! if ( q==null ) ! { ! q = new FilterTranslator(dialect); ! Put(cacheKey, q); ! } q.Compile(collectionRole, this, query, querySubstitutions, scalar); --- 328,340 ---- public FilterTranslator GetFilter(string query, string collectionRole, bool scalar) { ! // object cacheKey = FilterKeyFactory.NewInstance(collectionRole, query, scalar ); ! // ! // FilterTranslator q = (FilterTranslator) Get(cacheKey); ! // if ( q==null ) ! // { ! // q = new FilterTranslator(dialect); ! // Put(cacheKey, q); ! // } ! FilterTranslator q = new FilterTranslator(dialect); q.Compile(collectionRole, this, query, querySubstitutions, scalar); |
From: Michael D. <mik...@us...> - 2004-08-14 14:52:10
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.DomainModel In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25678/nhibernate/src/NHibernate.DomainModel Modified Files: Custom.hbm.xml CustomPersister.cs NHibernate.DomainModel-1.1.csproj Log Message: Implemented CustomPersister for Test Fixtures. Index: CustomPersister.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.DomainModel/CustomPersister.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** CustomPersister.cs 2 Jun 2004 04:53:24 -0000 1.1 --- CustomPersister.cs 14 Aug 2004 14:52:01 -0000 1.2 *************** *** 1,3 **** --- 1,13 ---- using System; + using System.Collections; + + using NHibernate.Cache; + using NHibernate.Metadata; + using NHibernate.Engine; + using NHibernate.Id; + using NHibernate.Impl; + using NHibernate.Mapping; + using NHibernate.Persister; + using NHibernate.Type; namespace NHibernate.DomainModel *************** *** 6,17 **** /// Summary description for CustomPersister. /// </summary> ! public class CustomPersister { ! public CustomPersister() { - // - // TODO: Add constructor logic here - // } } } --- 16,291 ---- /// Summary description for CustomPersister. /// </summary> ! public class CustomPersister : IClassPersister { ! ! private static readonly Hashtable Instances = new Hashtable(); ! private static readonly IIdentifierGenerator Generator = new CounterGenerator(); ! ! private static readonly IType[] Types = new IType[] { NHibernate.String }; ! private static readonly string[] Names = new string[] { "name" }; ! private static readonly bool[] Mutability = new bool[] { true }; ! ! public CustomPersister(PersistentClass model, ISessionFactory factory ) { } + + #region IClassPersister Members + + public object IdentifierSpace + { + get { return "CUSTOMS"; } + } + + public IClassMetadata ClassMetadata + { + get { return null; } + } + + public bool HasCache + { + get { return false; } + } + + public int[] FindDirty(object[] x, object[] y, object owner, ISessionImplementor session) + { + if( x[0].Equals(y[0])==false) + { + return new int[] {0}; + } + else + { + return null; + } + } + + public bool[] PropertyUpdateability + { + get { return Mutability; } + } + + public bool HasCascades + { + get { return false; } + } + + public object Instantiate(object id) + { + Custom c = new Custom(); + c.Id = (long)id; + return c; + } + + public IIdentifierGenerator IdentifierGenerator + { + get { return Generator; } + } + + public bool[] PropertyInsertability + { + get { return Mutability; } + } + + public System.Type MappedClass + { + get { return typeof(Custom); } + } + + public object Insert(object[] fields, object obj, ISessionImplementor session) + { + throw new NotSupportedException("CustomPersister.Insert withou Id is not supported."); + } + + public void Insert(object id, object[] fields, object obj, ISessionImplementor session) + { + Instances[id] = ((Custom)obj).Clone(); + } + + public bool IsUnsaved(object id) + { + return (long)id==0; + } + + public bool HasIdentifierPropertyOrEmbeddedCompositeIdentifier + { + get { return true;} + } + + public object GetVersion(object obj) + { + return null; + } + + public Cascades.CascadeStyle[] PropertyCascadeStyles + { + get { return null; } + } + + public object[] PropertySpaces + { + get { return new string[] { "CUSTOMS" }; } + } + + public void SetPropertyValues(object obj, object[] values) + { + Custom c = (Custom)obj; + c.Name = (string)values[0]; + } + + public IType[] PropertyTypes + { + get { return Types; } + } + + public bool IsIdentifierAssignedByInsert + { + get { return false; } + } + + public System.Type ConcreteProxyClass + { + get { return typeof(Custom); } + } + + public object GetIdentifier(object obj) + { + return (long)( (Custom)obj).Id; + } + + public object GetPropertyValue(object obj, int i) + { + return ( (Custom)obj).Name; + } + + public bool IsVersioned + { + get { return false; } + } + + public bool HasProxy + { + get { return false; } + } + + public void SetIdentifier(object obj, object id) + { + ( (Custom)obj).Id = (long)id; + } + + public bool ImplementsLifecycle + { + get { return false; } + } + + public object[] GetPropertyValues(object obj) + { + Custom c = (Custom)obj; + return new object[] {c.Name}; + } + + public string ClassName + { + get { return typeof(Custom).FullName; } + } + + public bool HasIdentifierProperty + { + get { return false; } + } + + public int VersionProperty + { + get { return 0; } + } + + public IType IdentifierType + { + get { return NHibernate.Int64; } + } + + public System.Reflection.PropertyInfo ProxyIdentifierProperty + { + get { return null; } + } + + public bool IsMutable + { + get { return true; } + } + + public bool HasCollections + { + get { return false; } + } + + public void Update(object id, object[] fields, int[] dirtyFields, object oldVersion, object obj, ISessionImplementor session) + { + Instances[id] = ( (Custom)obj).Clone(); + } + + public void Delete(object id, object version, object obj, ISessionImplementor session) + { + Instances.Remove(id); + } + + public string[] PropertyNames + { + get { return Names; } + } + + public void SetPropertyValue(object obj, int i, object value) + { + ( (Custom)obj).Name = (string)value; + } + + public object Load(object id, object optionalObject, LockMode lockMode, ISessionImplementor session) + { + Custom clone = null; + Custom obj = (Custom) Instances[id]; + if(obj!=null) + { + clone = (Custom)obj.Clone(); + session.AddUninitializedEntity( new Key(id, this), clone, LockMode.None ); + session.PostHydrate( this, id, new string[] {obj.Name}, clone, LockMode.None ); + session.InitializeEntity(clone); + } + return clone; + + } + + public ICacheConcurrencyStrategy Cache + { + get { return null; } + } + + public bool ImplementsValidatable + { + get { return false; } + } + + public void PostInstantiate(ISessionFactoryImplementor factory) + { + } + + public IVersionType VersionType + { + get { return null; } + } + + public string IdentifierPropertyName + { + get { return "Id"; } + } + + public System.Type[] ProxyInterfaces + { + get { return null; } + } + + public void Lock(object id, object version, object obj, LockMode lockMode, ISessionImplementor session) + { + throw new NotSupportedException("CustomPersister.Lock is not implemented"); + } + + #endregion } } Index: Custom.hbm.xml =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.DomainModel/Custom.hbm.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Custom.hbm.xml 9 Jun 2004 01:03:59 -0000 1.1 --- Custom.hbm.xml 14 Aug 2004 14:52:01 -0000 1.2 *************** *** 0 **** --- 1,17 ---- + <?xml version="1.0" ?> + <hibernate-mapping xmlns="urn:nhibernate-mapping-2.0"> + <class + name="NHibernate.DomainModel.Custom, NHibernate.DomainModel" + persister="NHibernate.DomainModel.CustomPersister, NHibernate.DomainModel" + > + <id + type="String" + name="key" + column="id_" + length="64" + unsaved-value="null" + > + <generator class="uuid.hex" /> + </id> + </class> + </hibernate-mapping> \ No newline at end of file Index: NHibernate.DomainModel-1.1.csproj =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.DomainModel/NHibernate.DomainModel-1.1.csproj,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** NHibernate.DomainModel-1.1.csproj 29 Jun 2004 04:28:08 -0000 1.20 --- NHibernate.DomainModel-1.1.csproj 14 Aug 2004 14:52:01 -0000 1.21 *************** *** 219,222 **** --- 219,226 ---- /> <File + RelPath = "Custom.hbm.xml" + BuildAction = "EmbeddedResource" + /> + <File RelPath = "CustomPersister.cs" SubType = "Code" |
From: Michael D. <mik...@us...> - 2004-08-13 19:32:06
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29192/nhibernate/src/NHibernate Modified Files: nhibernate.build Log Message: Fixed problem with build file when sign=false not correctly generating AssemblyInfo.cs Index: nhibernate.build =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/nhibernate.build,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** nhibernate.build 10 Aug 2004 16:40:14 -0000 1.13 --- nhibernate.build 13 Aug 2004 19:31:56 -0000 1.14 *************** *** 19,23 **** --> ! <property name="keyFile" value="" /> <target name="build" description="Build NHibernate"> --- 19,23 ---- --> ! <property name="keyFile" value="..\NHibernate.snk" /> <target name="build" description="Build NHibernate"> *************** *** 25,32 **** <attrib file="AssemblyInfo.cs" readonly="false" /> - <if propertytrue="sign"> - <property name="keyFile" value="..\NHibernate.snk" /> - </if> - <asminfo output="AssemblyInfo.cs" language="CSharp"> <imports> --- 25,28 ---- *************** *** 43,47 **** <attribute type="AssemblyInformationalVersionAttribute" value="${project.version.major}.${project.version.minor}" /> <attribute type="AssemblyFileVersionAttribute" value="${project.version}" /> ! <attribute type="AssemblyKeyFileAttribute" value="${keyFile}" /> </attributes> </asminfo> --- 39,43 ---- <attribute type="AssemblyInformationalVersionAttribute" value="${project.version.major}.${project.version.minor}" /> <attribute type="AssemblyFileVersionAttribute" value="${project.version}" /> ! <attribute type="AssemblyKeyFileAttribute" value="${keyFile}" if="${sign}"/> </attributes> </asminfo> |
From: Michael D. <mik...@us...> - 2004-08-13 18:57:33
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23346/nhibernate/src/NHibernate.Test Modified Files: FooBarTest.cs Log Message: Implemented more tests and added better descriptions to [Ignore]s. Index: FooBarTest.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/FooBarTest.cs,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** FooBarTest.cs 13 Aug 2004 13:26:35 -0000 1.55 --- FooBarTest.cs 13 Aug 2004 18:57:24 -0000 1.56 *************** *** 351,355 **** [Test] ! [Ignore("Test not written yet.")] public void ForceOuterJoin() { --- 351,355 ---- [Test] ! [Ignore("Proxies Required - http://jira.nhibernate.org:8080/browse/NH-41")] public void ForceOuterJoin() { *************** *** 434,440 **** [Test] ! [Ignore("Test not written yet.")] public void Limit() { } --- 434,461 ---- [Test] ! [Ignore("IQuery.SetMaxResults() - http://jira.nhibernate.org:8080/browse/NH-93")] public void Limit() { + ISession s = sessions.OpenSession(); + for( int i=0; i<10; i++) + { + s.Save( new Foo() ); + } + + IEnumerable enumerable = s.CreateQuery("from Foo foo") + .SetMaxResults(4) + .SetFirstResult(2) + .Enumerable(); + + int count = 0; + foreach(object obj in enumerable) + { + count++; + } + + Assert.AreEqual( 4, count ); + Assert.AreEqual( 10, s.Delete("from Foo foo") ); + s.Flush(); + s.Close(); } *************** *** 488,497 **** [Test] - [Ignore("Test not written yet.")] - public void Dyna() - { - } - - [Test] [Ignore("SetMaxResults - http://jira.nhibernate.org:8080/browse/NH-87")] public void FindByCriteria() --- 509,512 ---- *************** *** 2049,2053 **** [Test] ! [Ignore("Test not written yet.")] public void ScrollableIterator() { --- 2064,2068 ---- [Test] ! [Ignore("IScrollableResults - http://jira.nhibernate.org:8080/browse/NH-37")] public void ScrollableIterator() { *************** *** 2486,2492 **** [Test] - [Ignore("Test not written yet.")] public void OrderBy() { } --- 2501,2597 ---- [Test] public void OrderBy() { + ISession s = sessions.OpenSession(); + ITransaction t = s.BeginTransaction(); + Foo foo = new Foo(); + s.Save(foo); + IList list = s.Find("select foo from foo in class Foo, fee in class Fee where foo.Dependent = fee order by foo.String desc, foo.Component.Count asc, fee.id"); + Assert.AreEqual( 1, list.Count, "order by"); + Foo foo2 = new Foo(); + s.Save(foo2); + foo.TheFoo = foo2; + list = s.Find("select foo.TheFoo, foo.Dependent from foo in class Foo order by foo.TheFoo.String desc, foo.Component.Count asc, foo.Dependent.id"); + Assert.AreEqual( 1, list.Count, "order by" ); + list = s.Find("select foo from foo in class NHibernate.DomainModel.Foo order by foo.Dependent.id, foo.Dependent.Fi"); + Assert.AreEqual( 2, list.Count, "order by"); + s.Delete(foo); + s.Delete(foo2); + t.Commit(); + s.Close(); + + s = sessions.OpenSession(); + Many manyB = new Many(); + s.Save(manyB); + One oneB = new One(); + s.Save(oneB); + oneB.Value = "b"; + manyB.One = oneB; + Many manyA = new Many(); + s.Save(manyA); + One oneA = new One(); + s.Save(oneA); + oneA.Value = "a"; + manyA.One = oneA; + s.Flush(); + s.Close(); + + s = sessions.OpenSession(); + IEnumerable enumerable = s.Enumerable("SELECT one FROM one IN CLASS " + typeof(One).Name + " ORDER BY one.Value ASC"); + int count = 0; + foreach(One one in enumerable) + { + switch(count) + { + case 0: + Assert.AreEqual( "a", one.Value, "a - ordering failed" ); + break; + case 1: + Assert.AreEqual( "b", one.Value, "b - ordering failed" ); + break; + default: + Assert.Fail("more than two elements"); + break; + } + count++; + } + + s.Flush(); + s.Close(); + + s = sessions.OpenSession(); + enumerable = s.Enumerable("SELECT many.One FROM many IN CLASS " + typeof(Many).Name + " ORDER BY many.One.Value ASC, many.One.id"); + count = 0; + foreach(One one in enumerable) + { + switch(count) + { + case 0: + Assert.AreEqual( "a", one.Value, "'a' should be first element" ); + break; + case 1: + Assert.AreEqual( "b", one.Value, "'b' should be second element" ); + break; + default: + Assert.Fail("more than 2 elements"); + break; + } + count++; + } + s.Flush(); + s.Close(); + + s = sessions.OpenSession(); + oneA = (One)s.Load( typeof(One), oneA.Key ); + manyA = (Many)s.Load( typeof(Many), manyA.Key ); + oneB = (One)s.Load( typeof(One), oneB.Key ); + manyB = (Many)s.Load( typeof(Many), manyB.Key ); + s.Delete(manyA); + s.Delete(oneA); + s.Delete(manyB); + s.Delete(oneB); + s.Flush(); + s.Close(); + } *************** *** 2660,2666 **** [Test] - [Ignore("Test not written yet.")] public void SerializableType() { } --- 2765,2786 ---- [Test] public void SerializableType() { + ISession s = sessions.OpenSession(); + Vetoer v = new Vetoer(); + v.Strings = new string[] {"foo", "bar", "baz"}; + s.Save(v); + object id = s.Save(v); + v.Strings[1] = "osama"; + s.Flush(); + s.Close(); + + s = sessions.OpenSession(); + v = (Vetoer)s.Load( typeof(Vetoer), id ); + Assert.AreEqual( "osama", v.Strings[1], "serializable type" ); + s.Delete(v); + s.Delete(v); + s.Flush(); + s.Close(); } |
From: Michael D. <mik...@us...> - 2004-08-13 18:56:42
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23176/nhibernate/src/NHibernate.Test Modified Files: SQLFunctionsTest.cs Log Message: Implemented more tests. Index: SQLFunctionsTest.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/SQLFunctionsTest.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** SQLFunctionsTest.cs 6 Aug 2004 14:50:34 -0000 1.3 --- SQLFunctionsTest.cs 13 Aug 2004 18:56:33 -0000 1.4 *************** *** 1,3 **** --- 1,6 ---- using System; + using System.Collections; + + using NHibernate.DomainModel; using NUnit.Framework; *************** *** 20,42 **** [Test] - [Ignore("Test not written yet.")] public void SetProperties() { } [Test] - [Ignore("Test not written yet.")] public void NothingToUpdate() { } [Test] ! [Ignore("Test not written yet.")] public void SQLFunctions() { } [Test] ! [Ignore("Test not written yet.")] public void BlobClob() { --- 23,230 ---- [Test] public void SetProperties() { + ISession s = sessions.OpenSession(); + ITransaction t = s.BeginTransaction(); + Simple simple = new Simple(); + simple.Name = "Simple 1"; + s.Save(simple, (long)10); + IQuery q = s.CreateQuery("from s in class Simple where s.Name=:Name and s.Count=:Count"); + q.SetProperties(simple); + Assert.AreEqual( simple, q.List()[0]); + s.Delete(simple); + t.Commit(); + s.Close(); } [Test] public void NothingToUpdate() { + ISession s = sessions.OpenSession(); + ITransaction t = s.BeginTransaction(); + Simple simple = new Simple(); + simple.Name = "Simple 1"; + s.Save( simple, (long)10 ); + t.Commit(); + s.Close(); + + s = sessions.OpenSession(); + t = s.BeginTransaction(); + s.Update( simple, (long)10 ); + t.Commit(); + s.Close(); + + s = sessions.OpenSession(); + t = s.BeginTransaction(); + s.Update( simple, (long)10 ); + s.Delete(simple); + t.Commit(); + s.Close(); + } [Test] ! [Ignore("HQL 'IN' keyword problems - http://jira.nhibernate.org:8080/browse/NH-84, IScrollableResults - http://jira.nhibernate.org:8080/browse/NH-37")] public void SQLFunctions() { + ISession s = sessions.OpenSession(); + ITransaction t = s.BeginTransaction(); + Simple simple = new Simple(); + simple.Name = "Simple 1"; + s.Save( simple, (long)10 ); + + /* + * TODO: once DB2Dialect is implemented uncomment this + if( dialect is Dialect.DB2Dialect ) + { + s.Find("from s in class Simple where repeat('foo', 3) = 'foofoofoo'"); + s.Find("from s in class Simple where repeat(s.Name, 3) = 'foofoofoo'"); + s.Find("from s in class Simple where repeat( lower(s.Name), 3 + (1-1) / 2) = 'foofoofoo'"); + } + */ + + Assert.AreEqual( 1, s.Find("from s in class Simple where upper(s.Name) = 'SIMPLE 1'").Count ); + Assert.AreEqual( 1, s.Find("from s in class Simple where not( upper(s.Name)='yada' or 1=2 or 'foo'='bar' or not('foo'='foo') or 'foo' like 'bar')").Count ); + + if( !(dialect is Dialect.MySQLDialect) && !(dialect is Dialect.SybaseDialect) && !(dialect is Dialect.MsSql2000Dialect) ) + { + // Dialect.MckoiDialect and Dialect.InterbaseDialect also included + // My Sql has a funny concatenation operator + Assert.AreEqual( 1, s.Find("from s in class Simple where lower(s.Name || ' foo')='simple 1 foo'").Count ); + } + + if( (dialect is Dialect.SybaseDialect) ) + { + Assert.AreEqual( 1, s.Find("from s in class Simple where lower( concat(s.Name, ' foo') ) = 'simple 1 foo'").Count ); + } + + if( (dialect is Dialect.MsSql2000Dialect) ) + { + Assert.AreEqual( 1, s.Find("from s in class Simple where lower( s.Name + ' foo' ) = 'simple 1 foo'").Count ); + } + + /* + * TODO: uncomment if MckoiDialect is ever implemented + if( (dialect is Dialect.MckoiDialect) ) + { + Assert.AreEqual( 1, s.Find("from s in class Simple where lower( concat(s.Name, ' foo') ) = 'simple 1 foo'").Count ); + } + */ + + Simple other = new Simple(); + other.Name = "Simple 2"; + other.Count = 12; + simple.Other = other; + s.Save( other, (long)20 ); + Assert.AreEqual( 1, s.Find("from s in class Simple where upper( s.Other.Name )='SIMPLE 2'").Count ); + Assert.AreEqual( 0, s.Find("from s in class Simple where not (upper(s.Other.Name)='SIMPLE 2')").Count ); + Assert.AreEqual( 1, s.Find("select distinct s from s in class Simple where ( ( s.Other.Count + 3) = (15*2)/2 and s.Count = 69) or ( (s.Other.Count + 2) / 7 ) = 2").Count ); + Assert.AreEqual( 1, s.Find("select s from s in class Simple where ( ( s.Other.Count + 3) = (15*2)/2 and s.Count = 69) or ( (s.Other.Count + 2) / 7 ) = 2 order by s.Other.Count").Count ); + + Simple min = new Simple(); + min.Count = -1; + + s.Save( min, (long)30 ); + + // && !(dialect is Dialect.HSQLDialect) + // MySql has no subqueries + if( !(dialect is Dialect.MySQLDialect) ) + { + Assert.AreEqual( 2, s.Find("from s in class Simple where s.Count > ( select min(sim.Count) from sim in class NHibernate.DomainModel.Simple )").Count ); + t.Commit(); + t = s.BeginTransaction(); + Assert.AreEqual( 2, s.Find("from s in class Simple where s = some( select sim from sim in class NHibernate.DomainModel.Simple where sim.Count>=0) and s.Count >= 0").Count ); + Assert.AreEqual( 1, s.Find("from s in class Simple where s = some( select sim from sim in class NHibernate.DomainModel.Simple where sim.Other.Count=s.Other.Count ) and s.Other.Count > 0").Count ); + } + + IEnumerator enumer = s.Enumerable("select sum(s.Count) from s in class Simple group by s.Count having sum(s.Count) > 10 ").GetEnumerator(); + Assert.IsTrue( enumer.MoveNext() ); + Assert.AreEqual(12, (Int32)enumer.Current ); + Assert.IsFalse( enumer.MoveNext() ); + + if( !(dialect is Dialect.MySQLDialect) ) + { + enumer = s.Enumerable("select s.Count from s in class Simple group by s.Count having s.Count = 12").GetEnumerator(); + Assert.IsTrue( enumer.MoveNext() ); + } + + enumer = s.Enumerable("select s.id, s.Count, count(t), max(t.Date) from s in class Simple, t in class Simple where s.Count = t.Count group by s.id, s.Count order by s.Count").GetEnumerator(); + + IQuery q = s.CreateQuery("from s in class Simple"); + q.SetMaxResults(10); + Assert.AreEqual( 3, q.List().Count ); + + q = s.CreateQuery("from s in class Simple"); + q.SetMaxResults(1); + Assert.AreEqual( 1, q.List().Count ); + + q = s.CreateQuery("from s in class Simple"); + Assert.AreEqual( 3, q.List().Count ); + + q = s.CreateQuery("from s in class Simple where s.Name = ?"); + q.SetString(0, "Simple 1"); + Assert.AreEqual( 1, q.List().Count ); + + q = s.CreateQuery("from s in class Simple where s.Name = ? and upper(s.Name) = ?"); + q.SetString( 1, "SIMPLE 1" ); + q.SetString( 0, "Simple 1" ); + q.SetFirstResult(0); + Assert.IsTrue( q.Enumerable().GetEnumerator().MoveNext() ); + + q = s.CreateQuery("from s in class Simple where s.Name = :foo and upper(s.Name) = :bar or s.Count=:count or s.Count=:count + 1"); + q.SetParameter("bar", "SIMPLE 1"); + q.SetString("foo", "Simple 1"); + q.SetInt32("count", 69); + q.SetFirstResult(0); + Assert.IsTrue( q.Enumerable().GetEnumerator().MoveNext() ); + + q = s.CreateQuery("select s.id from s in class Simple"); + q.SetFirstResult(1); + q.SetMaxResults(2); + IEnumerable enumerable = q.Enumerable(); + int i=0; + foreach( object obj in enumerable ) + { + Assert.IsTrue( obj is Int64 ); + i++; + } + + Assert.AreEqual( 2, i ); + + q = s.CreateQuery("select all s, s.Other from s in class Simple where s = :s"); + q.SetParameter("s", simple); + Assert.AreEqual( 1, q.List().Count ); + + /* + * http://jira.nhibernate.org:8080/browse/NH-84 + q = s.CreateQuery("from s in class Simple where s.Name in (:name_list) and s.Count > :count"); + IList list = new ArrayList(2); + list.Add("Simple 1"); + list.Add("foo"); + q.SetParameterList( "name_list", list ); + q.SetParameter( "count", (int)-1 ); + Assert.AreEqual( 1, q.List().Count ); + */ + + /* + * http://jira.nhibernate.org:8080/browse/NH-37 + IScrollableResults sr = s.CreateQuery("from Simple s").Scroll(); + sr.Next(); + sr.GetInt64(0); + long lid = sr.Get(0, NHibernate.Int64); + Assert.AreEqual( lid, s.GetIdentifier( sr.Get(0, NHibernate.Entity(typeof(Simple)) ) ) ); + sr.Close(); + */ + + s.Delete(other); + s.Delete(simple); + s.Delete(min); + t.Commit(); + s.Close(); + } [Test] ! [Ignore("No BLOB/CLOB support yet - http://jira.nhibernate.org:8080/browse/NH-19")] public void BlobClob() { |
From: Michael D. <mik...@us...> - 2004-08-13 18:55:44
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Hql In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22976/nhibernate/src/NHibernate/Hql Modified Files: QueryTranslator.cs Log Message: Fixed problem with using SetParameter and with having a named parameter referenced twice in a query. Index: QueryTranslator.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Hql/QueryTranslator.cs,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** QueryTranslator.cs 4 Aug 2004 17:22:44 -0000 1.35 --- QueryTranslator.cs 13 Aug 2004 18:55:33 -0000 1.36 *************** *** 474,478 **** list.Add(o); list.Add(loc); ! namedParameters.Add(name, list); } else --- 474,478 ---- list.Add(o); list.Add(loc); ! namedParameters[name] = list; } else *************** *** 1286,1290 **** object[] paramValues = null; ! if(namedParams==null) { paramTypes = types; --- 1286,1290 ---- object[] paramValues = null; ! if(namedParams==null || namedParams.Count==0) { paramTypes = types; *************** *** 1300,1305 **** foreach (DictionaryEntry e in namedParams) { - int lastInsertedIndex = paramTypeList.Count; - string name = (string) e.Key; TypedValue typedval = (TypedValue) e.Value; --- 1300,1303 ---- *************** *** 1308,1311 **** --- 1306,1311 ---- for (int i = 0; i < locs.Length; i++) { + int lastInsertedIndex = paramTypeList.Count; + int insertAt = locs[i]; *************** *** 1314,1318 **** // of Range exception will be thrown if we add an element at an index // that is greater than the Count. ! if(insertAt >= lastInsertedIndex) { for(int j = lastInsertedIndex; j <= insertAt; j++) --- 1314,1318 ---- // of Range exception will be thrown if we add an element at an index // that is greater than the Count. ! if(insertAt >= lastInsertedIndex) { for(int j = lastInsertedIndex; j <= insertAt; j++) |
From: Michael D. <mik...@us...> - 2004-08-13 18:54:39
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.DomainModel In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22774/nhibernate/src/NHibernate.DomainModel Modified Files: Glarch.cs Glarch.hbm.xml GlarchProxy.cs Log Message: Removed dynabean from hbm.xml files and DomainModel. Index: Glarch.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.DomainModel/Glarch.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Glarch.cs 9 Aug 2004 03:06:18 -0000 1.6 --- Glarch.cs 13 Aug 2004 18:54:29 -0000 1.7 *************** *** 4,8 **** namespace NHibernate.DomainModel { - //TODO: figure out what to do with this DynaBean [Serializable] public class Glarch : Super, GlarchProxy, ILifecycle --- 4,7 ---- *************** *** 17,21 **** private GlarchProxy[] _proxyArray; private IDictionary _proxySet; - [NonSerialized] private object _dynaBean; private string _immutable; private int _derivedVersion; --- 16,19 ---- *************** *** 122,143 **** public LifecycleVeto OnSave(ISession s) { - /* DynaClass dc = new BasicDynaClass( - "dyna", - BasicDynaBean.class, - new DynaProperty[] { - new DynaProperty("foo", tString.class), - new DynaProperty("bar", Integer.class) - } - ); - try { - dynaBean = dc.newInstance(); - } - catch (Exception e) { - throw new CallbackException(e); - } - dynaBean.set("foo", "foo"); - dynaBean.set("bar", new Integer(66)); - immutable="never changes!"; - */ return LifecycleVeto.NoVeto; } --- 120,123 ---- *************** *** 150,162 **** #endregion - /// <summary> - /// Gets or sets the _dynaBean - /// </summary> - public object dynaBean - { - get { return _dynaBean; } - set { _dynaBean = value; } - } - /// <summary> --- 130,133 ---- Index: Glarch.hbm.xml =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.DomainModel/Glarch.hbm.xml,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Glarch.hbm.xml 3 Aug 2004 04:20:08 -0000 1.7 --- Glarch.hbm.xml 13 Aug 2004 18:54:29 -0000 1.8 *************** *** 48,56 **** /> - <dynabean name="dynaBean" dynaclass="foo"> - <property name="foo" type="String" /> - <property name="bar" type="Int32" /> - </dynabean> - <property name="X" /> --- 48,51 ---- Index: GlarchProxy.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.DomainModel/GlarchProxy.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** GlarchProxy.cs 24 Jun 2004 15:22:07 -0000 1.2 --- GlarchProxy.cs 13 Aug 2004 18:54:29 -0000 1.3 *************** *** 39,47 **** set; } ! object dynaBean ! { ! get; ! set; ! } IDictionary StringSets { --- 39,43 ---- set; } ! IDictionary StringSets { |
From: Michael D. <mik...@us...> - 2004-08-13 18:53:48
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22587/nhibernate/src/NHibernate Modified Files: nhibernate-mapping-2.0.xsd Log Message: Removed dynabean from mapping schema and Binder. Index: nhibernate-mapping-2.0.xsd =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/nhibernate-mapping-2.0.xsd,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** nhibernate-mapping-2.0.xsd 20 Apr 2004 15:51:24 -0000 1.4 --- nhibernate-mapping-2.0.xsd 13 Aug 2004 18:53:39 -0000 1.5 *************** *** 70,74 **** <xs:element ref='one-to-one' /> <xs:element ref='component' /> - <xs:element ref='dynabean' /> <xs:element ref='any' /> <xs:element ref='map' /> --- 70,73 ---- *************** *** 274,278 **** <xs:element ref='one-to-one' /> <xs:element ref='component' /> - <xs:element ref='dynabean' /> <xs:element ref='any' /> <xs:element ref='map' /> --- 273,276 ---- *************** *** 330,334 **** <xs:element ref='one-to-one' /> <xs:element ref='component' /> - <xs:element ref='dynabean' /> <xs:element ref='any' /> <xs:element ref='map' /> --- 328,331 ---- *************** *** 586,590 **** <xs:element ref='one-to-one' /> <xs:element ref='component' /> - <xs:element ref='dynabean' /> <xs:element ref='any' /> <xs:element ref='map' /> --- 583,586 ---- *************** *** 640,681 **** </xs:complexType> </xs:element> - <xs:element name='dynabean'> - <xs:complexType> - <xs:sequence> - <xs:choice minOccurs='0' maxOccurs='unbounded'> - <xs:element ref='property' /> - <xs:element ref='many-to-one' /> - <xs:element ref='one-to-one' /> - <xs:element ref='component' /> - <xs:element ref='dynabean' /> - <xs:element ref='any' /> - <xs:element ref='map' /> - <xs:element ref='set' /> - <xs:element ref='list' /> - <xs:element ref='bag' /> - <xs:element ref='array' /> - <xs:element ref='primitive-array' /> - </xs:choice> - </xs:sequence> - <xs:attribute name='dynaclass' use='required' /> - <xs:attribute name='name' use='required' /> - <xs:attribute name='update' default='true'> - <xs:simpleType> - <xs:restriction base='xs:string'> - <xs:enumeration value='true' /> - <xs:enumeration value='false' /> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - <xs:attribute name='insert' default='true'> - <xs:simpleType> - <xs:restriction base='xs:string'> - <xs:enumeration value='true' /> - <xs:enumeration value='false' /> - </xs:restriction> - </xs:simpleType> - </xs:attribute> - </xs:complexType> - </xs:element> <xs:element name='element'> <xs:complexType> --- 636,639 ---- |
From: Michael D. <mik...@us...> - 2004-08-13 18:53:48
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Cfg In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22587/nhibernate/src/NHibernate/Cfg Modified Files: Binder.cs Log Message: Removed dynabean from mapping schema and Binder. Index: Binder.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Cfg/Binder.cs,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** Binder.cs 4 Jun 2004 19:59:29 -0000 1.25 --- Binder.cs 13 Aug 2004 18:53:39 -0000 1.26 *************** *** 754,758 **** BindValue(subnode, value, isNullable, propertyName); } ! else if ( "component".Equals(name) || "dynabean".Equals(name) || "nested-composite-element".Equals(name) ) { System.Type subreflectedClass = (model.ComponentClass==null) ? --- 754,758 ---- BindValue(subnode, value, isNullable, propertyName); } ! else if ( "component".Equals(name) || "nested-composite-element".Equals(name) ) { System.Type subreflectedClass = (model.ComponentClass==null) ? |
From: Michael D. <mik...@us...> - 2004-08-13 13:26:44
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24228/nhibernate/src/NHibernate.Test Modified Files: FooBarTest.cs ParentChildTest.cs Log Message: Implemented more tests. Index: ParentChildTest.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/ParentChildTest.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ParentChildTest.cs 6 Aug 2004 14:50:34 -0000 1.6 --- ParentChildTest.cs 13 Aug 2004 13:26:35 -0000 1.7 *************** *** 223,229 **** [Test] - [Ignore("Test not written yet.")] public void Container() { } --- 223,362 ---- [Test] public void Container() { + ISession s = sessions.OpenSession(); + ITransaction t = s.BeginTransaction(); + Container c = new Container(); + Simple x = new Simple(); + x.Count = 123; + Simple y = new Simple(); + y.Count = 456; + s.Save( x, (long)1 ); + s.Save( y, (long)0 ); + IList o2m = new ArrayList(); + o2m.Add(x); + o2m.Add(null); + o2m.Add(y); + IList m2m = new ArrayList(); + m2m.Add(x); + m2m.Add(null); + m2m.Add(y); + c.OneToMany = o2m; + c.ManyToMany = m2m; + IList comps = new ArrayList(); + Container.ContainerInnerClass ccic = new Container.ContainerInnerClass(); + ccic.Name = "foo"; + ccic.Simple = x; + comps.Add(ccic); + comps.Add(null); + ccic = new Container.ContainerInnerClass(); + ccic.Name = "bar"; + ccic.Simple = y; + comps.Add(ccic); + + IDictionary compos = new Hashtable(); + object emptyObj = new object(); + compos.Add( ccic, emptyObj ); + c.Composites = compos; + c.Components = comps; + One one = new One(); + Many many = new Many(); + IDictionary manies = new Hashtable(); + manies.Add( many, emptyObj ); + one.Manies = manies; + many.One = one; + ccic.Many = many; + ccic.One = one; + s.Save(one); + s.Save(many); + s.Save(c); + t.Commit(); + s.Close(); + + s = sessions.OpenSession(); + t = s.BeginTransaction(); + c = (Container)s.Load( typeof(Container), c.Id ); + + ccic = (Container.ContainerInnerClass)c.Components[2]; + Assert.AreEqual( ccic.One, ccic.Many.One ); + Assert.AreEqual( 3, c.Components.Count ); + Assert.AreEqual( 1, c.Composites.Count ); + Assert.AreEqual( 3, c.OneToMany.Count ); + Assert.AreEqual( 3, c.ManyToMany.Count ); + + for( int i=0; i<3; i++ ) + { + Assert.AreEqual( c.ManyToMany[i], c.OneToMany[i] ); + } + object o1 = c.OneToMany[0]; + object o2 = c.OneToMany[2]; + c.OneToMany.RemoveAt(2); + c.OneToMany[0] = o2; + c.OneToMany[1] = o1; + o1 = c.Components[2]; + c.Components.RemoveAt(2); + c.Components[0] = o1; + c.ManyToMany[0] = c.ManyToMany[2]; + c.Composites.Add(o1, emptyObj); + t.Commit(); + s.Close(); + + s = sessions.OpenSession(); + t = s.BeginTransaction(); + c = (Container)s.Load( typeof(Container), c.Id ); + Assert.AreEqual( 1, c.Components.Count ); //WAS: 2 - h2.0.3 comment + Assert.AreEqual( 2, c.Composites.Count ); + Assert.AreEqual( 2, c.OneToMany.Count ); + Assert.AreEqual( 3, c.ManyToMany.Count ); + Assert.IsNotNull( c.OneToMany[0] ); + Assert.IsNotNull( c.OneToMany[1] ); + + ( (Container.ContainerInnerClass)c.Components[0]).Name = "a different name"; + IEnumerator enumer = c.Composites.Keys.GetEnumerator(); + enumer.MoveNext(); + ( (Container.ContainerInnerClass)enumer.Current).Name = "once again"; + t.Commit(); + s.Close(); + + s = sessions.OpenSession(); + t = s.BeginTransaction(); + c = (Container)s.Load( typeof(Container), c.Id ); + Assert.AreEqual( 1, c.Components.Count ); //WAS: 2 -> h2.0.3 comment + Assert.AreEqual( 2, c.Composites.Count ); + Assert.AreEqual( "a different name", ((Container.ContainerInnerClass)c.Components[0]).Name ); + enumer = c.Composites.Keys.GetEnumerator(); + bool found = false; + while( enumer.MoveNext() ) + { + if( ( (Container.ContainerInnerClass)enumer.Current).Name.Equals("once again") ) + { + found = true; + } + } + + Assert.IsTrue(found); + c.OneToMany.Clear(); + c.ManyToMany.Clear(); + c.Composites.Clear(); + c.Components.Clear(); + s.Delete("from s in class Simple"); + s.Delete("from m in class Many"); + s.Delete("from o in class One"); + t.Commit(); + s.Close(); + + s = sessions.OpenSession(); + t = s.BeginTransaction(); + c = (Container)s.Load( typeof(Container), c.Id ); + Assert.AreEqual( 0, c.Components.Count ); + Assert.AreEqual( 0, c.Composites.Count ); + Assert.AreEqual( 0, c.OneToMany.Count ); + Assert.AreEqual( 0, c.ManyToMany.Count ); + s.Delete(c); + t.Commit(); + s.Close(); + + + } *************** *** 292,322 **** [Test] - [Ignore("Test not written yet.")] public void Bag() { } [Test] - [Ignore("Test not written yet.")] public void CircularCascade() { } [Test] - [Ignore("Test not written yet.")] public void DeleteEmpty() { } [Test] - [Ignore("Test not written yet.")] public void Locking() { } [Test] - [Ignore("Test not written yet.")] public void ObjectType() { } --- 425,676 ---- [Test] public void Bag() { + //if( dialect is Dialect.HSQLDialect ) return; + + ISession s = sessions.OpenSession(); + ITransaction t = s.BeginTransaction(); + Container c = new Container(); + Contained c1 = new Contained(); + Contained c2 = new Contained(); + c.Bag = new ArrayList(); + c.Bag.Add(c1); + c.Bag.Add(c2); + c1.Bag.Add(c); + c2.Bag.Add(c); + s.Save(c); + c.Bag.Add(c2); + c2.Bag.Add(c); + c.LazyBag.Add(c1); + c1.LazyBag.Add(c); + t.Commit(); + s.Close(); + + s = sessions.OpenSession(); + t = s.BeginTransaction(); + c = (Container)s.Find("from c in class ContainerX")[0]; + Assert.AreEqual( 1, c.LazyBag.Count ); + t.Commit(); + s.Close(); + + s = sessions.OpenSession(); + t = s.BeginTransaction(); + c = (Container)s.Find("from c in class ContainerX")[0]; + Contained c3 = new Contained(); + // commented out in h2.0.3 also + //c.Bag.Add(c3); + //c3.Bag.Add(c); + c.LazyBag.Add(c3); + c3.LazyBag.Add(c); + t.Commit(); + s.Close(); + + s = sessions.OpenSession(); + t = s.BeginTransaction(); + c = (Container)s.Find("from c in class ContainerX")[0]; + Contained c4 = new Contained(); + c.LazyBag.Add(c4); + c4.LazyBag.Add(c); + Assert.AreEqual( 3, c.LazyBag.Count ); //forces initialization + // s.Save(c4); commented in h2.0.3 also + t.Commit(); + s.Close(); + + s = sessions.OpenSession(); + t = s.BeginTransaction(); + c = (Container)s.Find("from c in class ContainerX")[0]; + int j = 0; + foreach(object obj in c.Bag) + { + Assert.IsNotNull(obj); + j++; + } + + Assert.AreEqual( 3, j); + Assert.AreEqual( 3, c.LazyBag.Count ); + s.Delete(c); + c.Bag.Remove(c2); + + j = 0; + foreach(object obj in c.Bag) + { + j++; + s.Delete(obj); + } + + Assert.AreEqual( 2, j ); + s.Delete( s.Load( typeof(Contained), c4.Id ) ); + s.Delete( s.Load( typeof(Contained), c3.Id ) ); + t.Commit(); + s.Close(); + } [Test] public void CircularCascade() { + ISession s = sessions.OpenSession(); + ITransaction t = s.BeginTransaction(); + Circular c = new Circular(); + c.Clazz = typeof(Circular); + c.Other = new Circular(); + c.Other.Other = new Circular(); + c.Other.Other.Other = c; + c.AnyEntity = c.Other; + string id = (string)s.Save(c); + t.Commit(); + s.Close(); + + s = sessions.OpenSession(); + t = s.BeginTransaction(); + c = (Circular)s.Load( typeof(Circular), id ); + c.Other.Other.Clazz = typeof(Foo); + t.Commit(); + s.Close(); + + c.Other.Clazz = typeof(Qux); + s = sessions.OpenSession(); + t = s.BeginTransaction(); + s.SaveOrUpdate(c); + t.Commit(); + s.Close(); + + c.Other.Other.Clazz = typeof(Bar); + s = sessions.OpenSession(); + t = s.BeginTransaction(); + s.SaveOrUpdate(c); + t.Commit(); + s.Close(); + + s = sessions.OpenSession(); + t = s.BeginTransaction(); + c = (Circular)s.Load( typeof(Circular), id ); + Assert.AreEqual( typeof(Bar), c.Other.Other.Clazz ); + Assert.AreEqual( typeof(Qux), c.Other.Clazz ); + Assert.AreEqual( c, c.Other.Other.Other ); + Assert.AreEqual( c.Other , c.AnyEntity ); + Assert.AreEqual( 3, s.Delete("from o in class Universe") ); + t.Commit(); + s.Close(); + } [Test] public void DeleteEmpty() { + ISession s = sessions.OpenSession(); + Assert.AreEqual( 0, s.Delete("from s in class Simple") ); + Assert.AreEqual( 0, s.Delete("from o in class Universe") ); + s.Close(); } [Test] public void Locking() { + ISession s = sessions.OpenSession(); + ITransaction tx = s.BeginTransaction(); + Simple s1 = new Simple(); + s1.Count = 1; + Simple s2 = new Simple(); + s2.Count = 2; + Simple s3 = new Simple(); + s3.Count = 3; + Simple s4 = new Simple(); + s4.Count = 4; + + s.Save(s1, (long)1); + s.Save(s2, (long)2); + s.Save(s3, (long)3); + s.Save(s4, (long)4); + Assert.AreEqual( LockMode.Write, s.GetCurrentLockMode(s1) ); + tx.Commit(); + s.Close(); + + s = sessions.OpenSession(); + tx = s.BeginTransaction(); + s1 = (Simple)s.Load( typeof(Simple), (long)1, LockMode.None ); + Assert.AreEqual( LockMode.Read, s.GetCurrentLockMode(s1) ); + s2 = (Simple)s.Load( typeof(Simple), (long)2, LockMode.Read ); + Assert.AreEqual( LockMode.Read, s.GetCurrentLockMode(s2) ); + s3 = (Simple)s.Load( typeof(Simple), (long)3, LockMode.Upgrade ); + Assert.AreEqual( LockMode.Upgrade, s.GetCurrentLockMode(s3) ); + s4 = (Simple)s.Load( typeof(Simple), (long)4, LockMode.UpgradeNoWait ); + Assert.AreEqual( LockMode.UpgradeNoWait, s.GetCurrentLockMode(s4) ); + + s1 = (Simple)s.Load( typeof(Simple), (long)1, LockMode.Upgrade ); //upgrade + Assert.AreEqual( LockMode.Upgrade, s.GetCurrentLockMode(s1) ); + s2 = (Simple)s.Load( typeof(Simple), (long)2, LockMode.None ); + Assert.AreEqual( LockMode.Read, s.GetCurrentLockMode(s2) ); + s3 = (Simple)s.Load( typeof(Simple), (long)3, LockMode.Read ); + Assert.AreEqual( LockMode.Upgrade, s.GetCurrentLockMode(s3) ); + s4 = (Simple)s.Load( typeof(Simple), (long)4, LockMode.Upgrade ); + Assert.AreEqual( LockMode.UpgradeNoWait, s.GetCurrentLockMode(s4) ); + + s.Lock( s2, LockMode.Upgrade ); //upgrade + Assert.AreEqual( LockMode.Upgrade, s.GetCurrentLockMode(s2) ); + s.Lock( s3, LockMode.Upgrade ); + Assert.AreEqual( LockMode.Upgrade , s.GetCurrentLockMode(s3) ); + s.Lock( s1, LockMode.UpgradeNoWait ); + s.Lock( s4, LockMode.None ); + Assert.AreEqual( LockMode.UpgradeNoWait, s.GetCurrentLockMode(s4) ); + + tx.Commit(); + tx = s.BeginTransaction(); + + Assert.AreEqual( LockMode.None, s.GetCurrentLockMode(s3) ); + Assert.AreEqual( LockMode.None, s.GetCurrentLockMode(s1) ); + Assert.AreEqual( LockMode.None, s.GetCurrentLockMode(s2) ); + Assert.AreEqual( LockMode.None, s.GetCurrentLockMode(s4) ); + + s.Lock( s1, LockMode.Read ); //upgrade + Assert.AreEqual( LockMode.Read, s.GetCurrentLockMode(s1) ); + s.Lock( s2, LockMode.Upgrade ); //upgrade + Assert.AreEqual( LockMode.Upgrade, s.GetCurrentLockMode(s2) ); + s.Lock( s3, LockMode.UpgradeNoWait ); //upgrade + Assert.AreEqual( LockMode.UpgradeNoWait , s.GetCurrentLockMode(s3) ); + s.Lock( s4, LockMode.None ); + Assert.AreEqual( LockMode.None , s.GetCurrentLockMode(s4) ); + + s4.Name = "s4"; + s.Flush(); + Assert.AreEqual( LockMode.Write, s.GetCurrentLockMode(s4) ); + tx.Commit(); + + tx = s.BeginTransaction(); + Assert.AreEqual( LockMode.None, s.GetCurrentLockMode(s3) ); + Assert.AreEqual( LockMode.None, s.GetCurrentLockMode(s1) ); + Assert.AreEqual( LockMode.None, s.GetCurrentLockMode(s2) ); + Assert.AreEqual( LockMode.None, s.GetCurrentLockMode(s4) ); + + s.Delete(s1); + s.Delete(s2); + s.Delete(s3); + s.Delete(s4); + tx.Commit(); + s.Close(); + + } [Test] public void ObjectType() { + ISession s = sessions.OpenSession(); + Parent g = new Parent(); + Foo foo = new Foo(); + g.Any = foo; + s.Save(g); + s.Save(foo); + s.Flush(); + s.Close(); + + s = sessions.OpenSession(); + g = (Parent)s.Load( typeof(Parent), g.Id ); + Assert.IsNotNull( g.Any ); + Assert.IsTrue( g.Any is FooProxy ); + s.Delete( g.Any ); + s.Delete(g); + s.Flush(); + s.Close(); } Index: FooBarTest.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/FooBarTest.cs,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** FooBarTest.cs 9 Aug 2004 18:44:54 -0000 1.54 --- FooBarTest.cs 13 Aug 2004 13:26:35 -0000 1.55 *************** *** 201,205 **** [Test] - [Ignore("Test is failing and need to debug.")] public void QueryLockMode() { --- 201,204 ---- *************** *** 228,238 **** Assert.AreEqual( LockMode.None, s.GetCurrentLockMode(b) ); s.Find("from Foo foo"); ! //TODO: test is failing here because CurrentLock Mode is LockMode.Write ! Assert.AreEqual( LockMode.None, s.GetCurrentLockMode(b) ); q = s.CreateQuery("from Foo foo"); q.SetLockMode("foo", LockMode.Read); q.List(); ! Assert.AreEqual( LockMode.Read, s.GetCurrentLockMode(b) ); s.Evict(baz); --- 227,239 ---- Assert.AreEqual( LockMode.None, s.GetCurrentLockMode(b) ); s.Find("from Foo foo"); ! // When Proxies are implemented this will need to be changed to LockMode.None ! Assert.AreEqual( LockMode.Write, s.GetCurrentLockMode(b) ); q = s.CreateQuery("from Foo foo"); q.SetLockMode("foo", LockMode.Read); q.List(); ! // When Proxies are implemented this will need to be changed to LockMode.Read ! // because the current LockMode.Write won't downgrade to LockMode.Read ! Assert.AreEqual( LockMode.Write, s.GetCurrentLockMode(b) ); s.Evict(baz); |
From: Michael D. <mik...@us...> - 2004-08-13 13:26:44
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.DomainModel In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24228/nhibernate/src/NHibernate.DomainModel Modified Files: ParentChild.hbm.xml Log Message: Implemented more tests. Index: ParentChild.hbm.xml =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.DomainModel/ParentChild.hbm.xml,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ParentChild.hbm.xml 3 Aug 2004 04:20:08 -0000 1.3 --- ParentChild.hbm.xml 13 Aug 2004 13:26:35 -0000 1.4 *************** *** 14,18 **** <property name="Count" column="count_"/> <one-to-one name="Child"/> ! <property name="Any"> <column name="any_id"/> <column name="any_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"/> |
From: Michael D. <mik...@us...> - 2004-08-13 13:25:32
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Type In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24059/nhibernate/src/NHibernate/Type Modified Files: TypeType.cs Log Message: Fixed a stupid NullReferenceException. Index: TypeType.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Type/TypeType.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TypeType.cs 10 Feb 2004 18:41:42 -0000 1.1 --- TypeType.cs 13 Aug 2004 13:25:23 -0000 1.2 *************** *** 107,110 **** --- 107,121 ---- public override bool Equals(object x, object y) { + + if(x==null && y==null) + { + return true; + } + + if(x==null || y==null) + { + return false; + } + return x.Equals(y); } |