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: Sergey K. <jus...@us...> - 2005-03-26 13:24:50
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Type In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1460/src/NHibernate/Type Modified Files: EntityType.cs Log Message: Ported property-ref attribute implementation from Hibernate 2.1 Index: EntityType.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Type/EntityType.cs,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** EntityType.cs 1 Mar 2005 16:24:50 -0000 1.9 --- EntityType.cs 26 Mar 2005 13:24:37 -0000 1.10 *************** *** 88,92 **** protected object GetIdentifier( object value, ISessionImplementor session ) { ! return session.GetEntityIdentifierIfNotUnsaved( value ); } --- 88,105 ---- protected object GetIdentifier( object value, ISessionImplementor session ) { ! if( uniqueKeyPropertyName==null ) ! { ! return session.GetEntityIdentifierIfNotUnsaved( value ); //tolerates nulls ! } ! else if( value == null ) ! { ! return null; ! } ! else ! { ! return session.Factory ! .GetPersister( AssociatedClass ) ! .GetPropertyValue( value, uniqueKeyPropertyName ); ! } } *************** *** 224,230 **** else { ! // TODO: Extend ISessionImplentor interface ! //return session.LoadByUniqueKey( AssociatedClass, uniqueKeyPropertyName, id ); ! throw new NotImplementedException( "session.LoadByUniqueKey not implemented" ); } } --- 237,241 ---- else { ! return session.LoadByUniqueKey( AssociatedClass, uniqueKeyPropertyName, id ); } } |
From: Sergey K. <jus...@us...> - 2005-03-26 13:24:50
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Persister In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1460/src/NHibernate/Persister Modified Files: AbstractEntityPersister.cs EntityPersister.cs IClassPersister.cs Log Message: Ported property-ref attribute implementation from Hibernate 2.1 Index: IClassPersister.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Persister/IClassPersister.cs,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** IClassPersister.cs 14 Mar 2005 18:53:15 -0000 1.11 --- IClassPersister.cs 26 Mar 2005 13:24:37 -0000 1.12 *************** *** 127,130 **** --- 127,138 ---- /// <summary> + /// Set the value of a particular property + /// </summary> + /// <param name="obj"></param> + /// <param name="name"></param> + /// <param name="value"></param> + void SetPropertyValue( object obj, string name, object value ); + + /// <summary> /// Get the value of a particular property /// </summary> *************** *** 135,138 **** --- 143,154 ---- /// <summary> + /// Get the value of a particular property + /// </summary> + /// <param name="obj"></param> + /// <param name="name"></param> + /// <returns></returns> + object GetPropertyValue( object obj, string name ); + + /// <summary> /// Get the type of a particular property /// </summary> Index: EntityPersister.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Persister/EntityPersister.cs,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** EntityPersister.cs 14 Mar 2005 22:41:38 -0000 1.38 --- EntityPersister.cs 26 Mar 2005 13:24:37 -0000 1.39 *************** *** 428,431 **** --- 428,433 ---- loaders.Add( LockMode.UpgradeNoWait, new SimpleEntityLoader( this, selectForUpdateNoWaitString, LockMode.UpgradeNoWait, factory.Dialect ) ); + + CreateUniqueKeyLoaders( factory ); } Index: AbstractEntityPersister.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Persister/AbstractEntityPersister.cs,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** AbstractEntityPersister.cs 14 Mar 2005 18:53:15 -0000 1.35 --- AbstractEntityPersister.cs 26 Mar 2005 13:24:37 -0000 1.36 *************** *** 1336,1340 **** // TODO: 2.1 - Change EntityLoader to handle this //uniqueKeyLoaders.Add( propertyNames[ i ], new EntityLoader( this, columns, uniqueKeyType, factory ) ); ! //uniqueKeyLoaders.Add( propertyNames[ i ], new EntityLoader( this, columns, uniqueKeyType, factory ) ); } } --- 1336,1340 ---- // TODO: 2.1 - Change EntityLoader to handle this //uniqueKeyLoaders.Add( propertyNames[ i ], new EntityLoader( this, columns, uniqueKeyType, factory ) ); ! uniqueKeyLoaders.Add( propertyNames[ i ], new EntityLoader( this, columns, uniqueKeyType, 1, factory ) ); } } |
From: Sergey K. <jus...@us...> - 2005-03-26 13:24:48
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1460/src/NHibernate/Util Modified Files: ReflectHelper.cs Log Message: Ported property-ref attribute implementation from Hibernate 2.1 Index: ReflectHelper.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Util/ReflectHelper.cs,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** ReflectHelper.cs 14 Mar 2005 14:37:59 -0000 1.24 --- ReflectHelper.cs 26 Mar 2005 13:24:37 -0000 1.25 *************** *** 134,137 **** --- 134,148 ---- /// <summary> + /// Get the <see cref="System.Type" /> for the named property of a type. + /// </summary> + /// <param name="theClass">The <see cref="System.Type"/> to find the property in.</param> + /// <param name="name">The name of the property/field to find in the class.</param> + /// <returns>The <see cref="System.Type" /> for the named property.</returns> + public static System.Type ReflectedPropertyClass( System.Type theClass, string name) + { + return GetGetter(theClass, name).ReturnType; + } + + /// <summary> /// Returns a reference to the Type. /// </summary> |
From: Sergey K. <jus...@us...> - 2005-03-26 13:24:48
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Cfg In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1460/src/NHibernate/Cfg Modified Files: Binder.cs Configuration.cs Mappings.cs Log Message: Ported property-ref attribute implementation from Hibernate 2.1 Index: Mappings.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Cfg/Mappings.cs,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** Mappings.cs 21 Mar 2005 11:31:35 -0000 1.13 --- Mappings.cs 26 Mar 2005 13:24:36 -0000 1.14 *************** *** 31,35 **** private INamingStrategy namingStrategy; ! private class UniquePropertyReference { public System.Type ReferencedClass; --- 31,35 ---- private INamingStrategy namingStrategy; ! internal class UniquePropertyReference { public System.Type ReferencedClass; Index: Binder.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Cfg/Binder.cs,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** Binder.cs 21 Mar 2005 11:31:35 -0000 1.42 --- Binder.cs 26 Mar 2005 13:24:36 -0000 1.43 *************** *** 80,84 **** catch ( Exception cnfe ) { ! throw new MappingException( "persistent class not found", cnfe ); } --- 80,84 ---- catch ( Exception cnfe ) { ! throw new MappingException( "persistent class " + className + " not found", cnfe ); } Index: Configuration.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Cfg/Configuration.cs,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** Configuration.cs 15 Mar 2005 14:06:30 -0000 1.35 --- Configuration.cs 26 Mar 2005 13:24:36 -0000 1.36 *************** *** 716,721 **** secondPasses.Clear(); ! //TODO: Somehow add the newly created foreign keys to the internal collection log.Info( "processing foreign key constraints" ); --- 716,744 ---- secondPasses.Clear(); ! log.Info("processing one-to-one association property references"); + foreach( Mappings.UniquePropertyReference upr in propertyReferences ) + { + PersistentClass clazz = GetClassMapping( upr.ReferencedClass ); + if ( clazz == null ) throw new MappingException( "property-ref to unmapped class: " + upr.ReferencedClass.Name ); + bool found = false; + + foreach( NHibernate.Mapping.Property prop in clazz.PropertyCollection ) + { + if ( upr.PropertyName.Equals( prop.Name ) ) + { + ( (SimpleValue) prop.Value ).IsUnique = true; + found = true; + break; + } + } + if (!found) throw new MappingException( + "property-ref not found: " + upr.PropertyName + + " in class: " + upr.ReferencedClass.Name + ); + } + + //TODO: Somehow add the newly created foreign keys to the internal collection + log.Info( "processing foreign key constraints" ); |
From: Paul H. <pha...@us...> - 2005-03-26 12:30:44
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1268/nhibernate/src/NHibernate/Impl Modified Files: AbstractQueryImpl.cs SessionImpl.cs Log Message: Minor 2.1 sync changes needed for SqlLoader Index: SessionImpl.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl/SessionImpl.cs,v retrieving revision 1.75 retrieving revision 1.76 diff -C2 -d -r1.75 -r1.76 *** SessionImpl.cs 18 Mar 2005 23:33:19 -0000 1.75 --- SessionImpl.cs 26 Mar 2005 12:30:24 -0000 1.76 *************** *** 857,861 **** if ( persister.HasCollections ) { ! // h2.1 has some extra code here for OnReplicateVisitor - is a new setting // that is only in h2.1 because of the method Replicate(object, ReplicateMode) WrapVisitor visitor = new WrapVisitor(this); --- 857,861 ---- if ( persister.HasCollections ) { ! // TODO - 2.1 has some extra code here for OnReplicateVisitor - is a new setting // that is only in h2.1 because of the method Replicate(object, ReplicateMode) WrapVisitor visitor = new WrapVisitor(this); Index: AbstractQueryImpl.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl/AbstractQueryImpl.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** AbstractQueryImpl.cs 6 Mar 2005 12:44:42 -0000 1.2 --- AbstractQueryImpl.cs 26 Mar 2005 12:30:23 -0000 1.3 *************** *** 2,9 **** using System.Collections; using System.Text; - using Iesi.Collections; - using NHibernate.Engine; using NHibernate.Property; using NHibernate.Proxy; --- 2,8 ---- using System.Collections; using System.Text; using Iesi.Collections; using NHibernate.Engine; + using NHibernate.Hql; using NHibernate.Property; using NHibernate.Proxy; *************** *** 30,33 **** --- 29,35 ---- private IDictionary namedParameters = new Hashtable( 4 ); private IDictionary namedParametersLists = new Hashtable( 4 ); + private bool cacheable; + private string cacheRegion; + private bool forceCacheRefresh; private static readonly object UNSET_PARAMETER = new Object(); private static readonly object UNSET_TYPE = new Object(); *************** *** 43,47 **** this.queryString = queryString; selection = new RowSelection(); - InitParameterBookKeeping(); } --- 45,48 ---- *************** *** 49,54 **** protected void VerifyParameters() { - actualNamedParameters = new ListSet( session.Factory.GetNamedParameters( queryString ) ); - if ( actualNamedParameters.Count != namedParameters.Count + namedParametersLists.Count ) { --- 50,53 ---- *************** *** 676,681 **** public IQuery SetParameterList( string name, ICollection vals, IType type ) { ! // HACK: Test for null should be removed once Filter parsing bug is resolved ! if ( actualNamedParameters != null && !actualNamedParameters.Contains(name) ) throw new ArgumentOutOfRangeException(string.Format("Parameter {0} does not exist as a named parameter in [{1}]", name, queryString)); --- 675,679 ---- public IQuery SetParameterList( string name, ICollection vals, IType type ) { ! if ( !actualNamedParameters.Contains(name) ) throw new ArgumentOutOfRangeException(string.Format("Parameter {0} does not exist as a named parameter in [{1}]", name, queryString)); *************** *** 709,713 **** string alias = name + i++ + StringHelper.Underscore; namedParams.Add( alias, new TypedValue( type, obj ) ); ! list.Append( ':' + alias ); if( i < vals.Count ) { --- 707,711 ---- string alias = name + i++ + StringHelper.Underscore; namedParams.Add( alias, new TypedValue( type, obj ) ); ! list.Append( ParserHelper.HqlVariablePrefix + alias ); if( i < vals.Count ) { *************** *** 716,720 **** } ! return StringHelper.Replace( queryString, ':' + name, list.ToString() ); } --- 714,718 ---- } ! return StringHelper.Replace( queryString, ParserHelper.HqlVariablePrefix + name, list.ToString() ); } *************** *** 737,742 **** private void InitParameterBookKeeping() { ! // HACK: Filter parsing bug causes this to fail e.g. select max(this.I) can't resolve 'this' ! //actualNamedParameters = new ListSet( session.Factory.GetNamedParameters( queryString ) ); positionalParameterCount = StringHelper.CountUnquoted( queryString, StringHelper.SqlParameter.ToCharArray()[0] ); } --- 735,753 ---- private void InitParameterBookKeeping() { ! StringTokenizer st = new StringTokenizer( queryString, ParserHelper.HqlSeparators ); ! ISet result = new HashedSet(); ! ! IEnumerator enumer = st.GetEnumerator(); ! while( enumer.MoveNext() ) ! { ! string str = (string) enumer.Current; ! if ( str.StartsWith( ParserHelper.HqlVariablePrefix ) ) ! { ! result.Add( str.Substring( 1 ) ); ! } ! } ! ! actualNamedParameters = result; ! // TODO: This is weak as it doesn't take account of ? embedded in the SQL positionalParameterCount = StringHelper.CountUnquoted( queryString, StringHelper.SqlParameter.ToCharArray()[0] ); } *************** *** 747,752 **** get { - // HACK: Remove once Filter parsing bug resolved - actualNamedParameters = new ListSet( session.Factory.GetNamedParameters( queryString ) ); string[ ] retVal = new String[actualNamedParameters.Count]; int i = 0; --- 758,761 ---- *************** *** 767,772 **** { System.Type clazz = bean.GetType(); - // HACK: Remove once Filter parsing bug resolved - actualNamedParameters = new ListSet( session.Factory.GetNamedParameters( queryString ) ); foreach( string namedParam in actualNamedParameters ) { --- 776,779 ---- |
From: Paul H. <pha...@us...> - 2005-03-26 12:28:19
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Driver In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32301/nhibernate/src/NHibernate/Driver Modified Files: DriverBase.cs Log Message: Fixed misleading error message Index: DriverBase.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Driver/DriverBase.cs,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** DriverBase.cs 1 Jan 2005 14:21:04 -0000 1.11 --- DriverBase.cs 26 Mar 2005 12:28:04 -0000 1.12 *************** *** 191,195 **** if( name != null && parameter != null && parameter.SqlType == null ) { ! throw new QueryException( String.Format( "No value assigned to parameter '{0}': be sure to set values for named parameters.", name ) ); } IDbDataParameter dbParam = command.CreateParameter(); --- 191,195 ---- if( name != null && parameter != null && parameter.SqlType == null ) { ! throw new QueryException( String.Format( "No type assigned to parameter '{0}': be sure to set types for named parameters.", name ) ); } IDbDataParameter dbParam = command.CreateParameter(); |
From: Paul H. <pha...@us...> - 2005-03-26 12:19:06
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/NHSpecificTest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27938/nhibernate/src/NHibernate.Test/NHSpecificTest Added Files: CollectionFixture.cs SimpleFooBarFixture.cs Log Message: Simpler tests used when porting from 2.1 - easier to see the execution flow when debugging --- NEW FILE: CollectionFixture.cs --- using System; using NHibernate.DomainModel.NHSpecific; using NUnit.Framework; namespace NHibernate.Test.NHSpecificTest { /// <summary> /// Tests loading of collections very simply. /// </summary> [TestFixture] public class CollectionFixture : TestCase { [SetUp] public void SetUp() { ExportSchema( new string[] { "NHSpecific.LazyLoadBug.hbm.xml"} ); } [Test] public void TestLoadParentFirst() { int parentId = 0; using( ISession s1 = sessions.OpenSession() ) using( ITransaction t1 = s1.BeginTransaction() ) { // create a new LLParent parent = new LLParent(); LLChildNoAdd child = new LLChildNoAdd(); parent.ChildrenNoAdd.Add( child ); child.Parent = parent; s1.Save( parent ); parentId = (int)s1.GetIdentifier( parent ); t1.Commit(); } // try to Load the object to make sure the save worked using( ISession s2 = sessions.OpenSession() ) using( ITransaction t2 = s2.BeginTransaction() ) { LLParent parent2 = (LLParent)s2.Load( typeof( LLParent ), parentId ); Assert.AreEqual( 1, parent2.ChildrenNoAdd.Count ); } } [Test] public void TestLoadChildFirst() { int parentId = 0; int childId = 0; using( ISession s1 = sessions.OpenSession() ) using( ITransaction t1 = s1.BeginTransaction() ) { // create a new LLParent parent = new LLParent(); LLChildNoAdd child = new LLChildNoAdd(); parent.ChildrenNoAdd.Add( child ); child.Parent = parent; s1.Save( parent ); parentId = (int)s1.GetIdentifier( parent ); childId = (int)s1.GetIdentifier( child ); t1.Commit(); } // try to Load the object to make sure the save worked using( ISession s2 = sessions.OpenSession() ) using( ITransaction t2 = s2.BeginTransaction() ) { LLChildNoAdd child2 = (LLChildNoAdd)s2.Load( typeof( LLChildNoAdd ), childId ); Assert.AreEqual( parentId, (int)s2.GetIdentifier( child2.Parent ) ); } } } } --- NEW FILE: SimpleFooBarFixture.cs --- using System; using System.Data; using NHibernate.DomainModel; using NUnit.Framework; namespace NHibernate.Test.NHSpecificTest { [TestFixture] public class SimpleFooBarFixture : TestCase { [SetUp] public void SetUp() { ExportSchema( new string[] { "FooBar.hbm.xml"} ); } } } |
From: Paul H. <pha...@us...> - 2005-03-26 12:15:12
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25631/nhibernate/src/NHibernate Modified Files: nhibernate-mapping-2.0.xsd Log Message: Put common attributes into attribute groups, general tidy up Index: nhibernate-mapping-2.0.xsd =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/nhibernate-mapping-2.0.xsd,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** nhibernate-mapping-2.0.xsd 18 Mar 2005 23:32:18 -0000 1.9 --- nhibernate-mapping-2.0.xsd 26 Mar 2005 12:15:01 -0000 1.10 *************** *** 46,49 **** --- 46,78 ---- </xs:restriction> </xs:simpleType> + <xs:attributeGroup name="baseClassAttributes"> + <xs:attribute name="name" type="xs:string" use="required"/> + <xs:attribute name="proxy" type="xs:string" use="optional"> + <xs:annotation> + <xs:documentation>default: no proxy interface </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="dynamic-update" type="xs:boolean" use="optional" default="false"/> + <xs:attribute name="dynamic-insert" type="xs:boolean" use="optional" default="false"/> + </xs:attributeGroup> + <xs:attributeGroup name="baseAssociationAttributes"> + <xs:attribute name="name" type="xs:string" use="required"/> + <xs:attribute name="access" type="propertyAccess" use="optional"/> + <xs:attribute name="table" type="xs:string" use="optional"/> + <xs:attribute name="schema" type="xs:string" use="optional"/> + <xs:attribute name="lazy" type="xs:boolean" use="optional" default="false"/> + <xs:attribute name="cascade" type="cascadeStyle" use="optional"/> + <xs:attribute name="where" type="xs:string" use="optional"/> + <xs:attribute name="inverse" type="xs:boolean" use="optional" default="false"/> + </xs:attributeGroup> + <xs:simpleType name="unsavedValueType"> + <xs:annotation> + <xs:documentation>Values used to restrict composite-id, does not apply to meta/column/generator</xs:documentation> + </xs:annotation> + <xs:restriction base="xs:string"> + <xs:enumeration value="any"/> + <xs:enumeration value="none"/> + </xs:restriction> + </xs:simpleType> <xs:element name="hibernate-mapping"> <xs:annotation> *************** *** 75,78 **** --- 104,109 ---- </xs:attribute> <xs:attribute name="auto-import" type="xs:boolean" use="optional" default="true"/> + <xs:attribute name="namespace" type="xs:string" use="optional"/> + <xs:attribute name="assembly" type="xs:string" use="optional"/> </xs:complexType> </xs:element> *************** *** 122,156 **** </xs:choice> </xs:sequence> ! <xs:attribute name="name" type="xs:string" use="required"/> ! <xs:attribute name="table" type="xs:string"> <xs:annotation> <xs:documentation>default: unqualified classname </xs:documentation> </xs:annotation> </xs:attribute> ! <xs:attribute name="schema" type="xs:string"> <xs:annotation> <xs:documentation>default: no value </xs:documentation> </xs:annotation> </xs:attribute> ! <xs:attribute name="proxy" type="xs:string"> ! <xs:annotation> ! <xs:documentation>default: no proxy interface </xs:documentation> ! </xs:annotation> ! </xs:attribute> ! <xs:attribute name="discriminator-value" type="xs:string"> <xs:annotation> <xs:documentation>default: unqualified class name | none </xs:documentation> </xs:annotation> </xs:attribute> ! <xs:attribute name="mutable" type="xs:boolean" default="true"/> ! <xs:attribute name="polymorphism" type="polymorphismType" default="implicit"/> ! <xs:attribute name="where" type="xs:string"> <xs:annotation> <xs:documentation>default: none </xs:documentation> </xs:annotation> </xs:attribute> - <xs:attribute name="persister" type="xs:string"/> - <xs:attribute name="dynamic-update" type="xs:boolean" default="false"/> - <xs:attribute name="dynamic-insert" type="xs:boolean" default="false"/> </xs:complexType> </xs:element> --- 153,180 ---- </xs:choice> </xs:sequence> ! <xs:attributeGroup ref="baseClassAttributes"/> ! <xs:attribute name="table" type="xs:string" use="optional"> <xs:annotation> <xs:documentation>default: unqualified classname </xs:documentation> </xs:annotation> </xs:attribute> ! <xs:attribute name="schema" type="xs:string" use="optional"> <xs:annotation> <xs:documentation>default: no value </xs:documentation> </xs:annotation> </xs:attribute> ! <xs:attribute name="discriminator-value" type="xs:string" use="optional"> <xs:annotation> <xs:documentation>default: unqualified class name | none </xs:documentation> </xs:annotation> </xs:attribute> ! <xs:attribute name="mutable" type="xs:boolean" use="optional" default="true"/> ! <xs:attribute name="polymorphism" type="polymorphismType" use="optional" default="implicit"/> ! <xs:attribute name="persister" type="xs:string" use="optional"/> ! <xs:attribute name="where" type="xs:string" use="optional"> <xs:annotation> <xs:documentation>default: none </xs:documentation> </xs:annotation> </xs:attribute> </xs:complexType> </xs:element> *************** *** 191,202 **** <xs:attribute name="name" type="xs:string"/> <xs:attribute name="access" type="propertyAccess"/> ! <xs:attribute name="unsaved-value" default="none"> ! <xs:simpleType> ! <xs:restriction base="xs:string"> ! <xs:enumeration value="any"/> ! <xs:enumeration value="none"/> ! </xs:restriction> ! </xs:simpleType> ! </xs:attribute> </xs:complexType> </xs:element> --- 215,219 ---- <xs:attribute name="name" type="xs:string"/> <xs:attribute name="access" type="propertyAccess"/> ! <xs:attribute name="unsaved-value" type="unsavedValueType" default="none"/> </xs:complexType> </xs:element> *************** *** 264,273 **** <xs:element ref="subclass" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> ! <xs:attribute name="name" type="xs:string" use="required"/> ! <xs:attribute name="proxy" type="xs:string" use="optional"> ! <xs:annotation> ! <xs:documentation>default: no proxy interface </xs:documentation> ! </xs:annotation> ! </xs:attribute> <xs:attribute name="discriminator-value" type="xs:string" use="optional"> <xs:annotation> --- 281,286 ---- <xs:element ref="subclass" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> ! <xs:attributeGroup ref="baseClassAttributes"/> ! <xs:attribute name="extends" type="xs:string" use="optional"/> <xs:attribute name="discriminator-value" type="xs:string" use="optional"> <xs:annotation> *************** *** 275,281 **** </xs:annotation> </xs:attribute> - <xs:attribute name="dynamic-update" type="xs:boolean" use="optional" default="false"/> - <xs:attribute name="dynamic-insert" type="xs:boolean" use="optional" default="false"/> - <xs:attribute name="extends" type="xs:string" use="optional"/> </xs:complexType> </xs:element> --- 288,291 ---- *************** *** 304,322 **** <xs:element ref="joined-subclass" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> ! <xs:attribute name="name" type="xs:string" use="required"/> ! <xs:attribute name="proxy" type="xs:string"> ! <xs:annotation> ! <xs:documentation>default: no proxy interface </xs:documentation> ! </xs:annotation> ! </xs:attribute> ! <xs:attribute name="table" type="xs:string"> <xs:annotation> <xs:documentation>default: unqualified classname </xs:documentation> </xs:annotation> </xs:attribute> - <xs:attribute name="schema" type="xs:string"/> - <xs:attribute name="dynamic-update" type="xs:boolean" default="false"/> - <xs:attribute name="dynamic-insert" type="xs:boolean" default="false"/> - <xs:attribute name="extends" type="xs:string" use="optional"/> </xs:complexType> </xs:element> --- 314,325 ---- <xs:element ref="joined-subclass" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> ! <xs:attributeGroup ref="baseClassAttributes"/> ! <xs:attribute name="extends" type="xs:string" use="optional"/> ! <xs:attribute name="schema" type="xs:string" use="optional"/> ! <xs:attribute name="table" type="xs:string" use="optional"> <xs:annotation> <xs:documentation>default: unqualified classname </xs:documentation> </xs:annotation> </xs:attribute> </xs:complexType> </xs:element> *************** *** 396,424 **** </xs:complexType> </xs:element> - <xs:element name="bag"> - <xs:complexType> - <xs:sequence> - <xs:element ref="meta" minOccurs="0" maxOccurs="unbounded"/> - <xs:element ref="jcs-cache" minOccurs="0"/> - <xs:element ref="key"/> - <xs:choice> - <xs:element ref="element"/> - <xs:element ref="one-to-many"/> - <xs:element ref="many-to-many"/> - <xs:element ref="composite-element"/> - <xs:element ref="many-to-any"/> - </xs:choice> - </xs:sequence> - <xs:attribute name="name" type="xs:string" use="required"/> - <xs:attribute name="access" type="propertyAccess"/> - <xs:attribute name="table" type="xs:string"/> - <xs:attribute name="schema" type="xs:string"/> - <xs:attribute name="lazy" type="xs:boolean" default="false"/> - <xs:attribute name="inverse" type="xs:boolean" default="false"/> - <xs:attribute name="cascade" type="cascadeStyle"/> - <xs:attribute name="order-by" type="xs:string"/> - <xs:attribute name="where" type="xs:string"/> - </xs:complexType> - </xs:element> <xs:element name="collection-id"> <xs:complexType> --- 399,402 ---- *************** *** 609,637 **** </xs:complexType> </xs:element> - <xs:element name="list"> - <xs:complexType> - <xs:sequence> - <xs:element ref="meta" minOccurs="0" maxOccurs="unbounded"/> - <xs:element ref="jcs-cache" minOccurs="0"/> - <xs:element ref="key"/> - <xs:element ref="index"/> - <xs:choice> - <xs:element ref="element"/> - <xs:element ref="one-to-many"/> - <xs:element ref="many-to-many"/> - <xs:element ref="composite-element"/> - <xs:element ref="many-to-any"/> - </xs:choice> - </xs:sequence> - <xs:attribute name="name" type="xs:string" use="required"/> - <xs:attribute name="access" type="propertyAccess"/> - <xs:attribute name="table" type="xs:string"/> - <xs:attribute name="schema" type="xs:string"/> - <xs:attribute name="lazy" type="xs:boolean" default="false"/> - <xs:attribute name="inverse" type="xs:boolean" default="false"/> - <xs:attribute name="cascade" type="cascadeStyle"/> - <xs:attribute name="where" type="xs:string"/> - </xs:complexType> - </xs:element> <xs:element name="many-to-any"> <xs:complexType> --- 587,590 ---- *************** *** 672,707 **** </xs:complexType> </xs:element> - <xs:element name="map"> - <xs:complexType> - <xs:sequence> - <xs:element ref="meta" minOccurs="0" maxOccurs="unbounded"/> - <xs:element ref="jcs-cache" minOccurs="0"/> - <xs:element ref="key"/> - <xs:choice> - <xs:element ref="index"/> - <xs:element ref="composite-index"/> - <xs:element ref="index-many-to-many"/> - <xs:element ref="index-many-to-any"/> - </xs:choice> - <xs:choice> - <xs:element ref="element"/> - <xs:element ref="one-to-many"/> - <xs:element ref="many-to-many"/> - <xs:element ref="composite-element"/> - <xs:element ref="many-to-any"/> - </xs:choice> - </xs:sequence> - <xs:attribute name="name" type="xs:string" use="required"/> - <xs:attribute name="access" type="propertyAccess"/> - <xs:attribute name="table" type="xs:string"/> - <xs:attribute name="schema" type="xs:string"/> - <xs:attribute name="lazy" type="xs:boolean" default="false"/> - <xs:attribute name="inverse" type="xs:boolean" default="false"/> - <xs:attribute name="sort" type="xs:string" default="unsorted"/> - <xs:attribute name="cascade" type="cascadeStyle"/> - <xs:attribute name="order-by" type="xs:string"/> - <xs:attribute name="where" type="xs:string"/> - </xs:complexType> - </xs:element> <xs:element name="meta"> <xs:complexType mixed="true"> --- 625,628 ---- *************** *** 774,777 **** --- 695,734 ---- </xs:complexType> </xs:element> + <xs:element name="list"> + <xs:complexType> + <xs:sequence> + <xs:element ref="meta" minOccurs="0" maxOccurs="unbounded"/> + <xs:element ref="jcs-cache" minOccurs="0"/> + <xs:element ref="key"/> + <xs:element ref="index"/> + <xs:choice> + <xs:element ref="element"/> + <xs:element ref="one-to-many"/> + <xs:element ref="many-to-many"/> + <xs:element ref="composite-element"/> + <xs:element ref="many-to-any"/> + </xs:choice> + </xs:sequence> + <xs:attributeGroup ref="baseAssociationAttributes"/> + </xs:complexType> + </xs:element> + <xs:element name="bag"> + <xs:complexType> + <xs:sequence> + <xs:element ref="meta" minOccurs="0" maxOccurs="unbounded"/> + <xs:element ref="jcs-cache" minOccurs="0"/> + <xs:element ref="key"/> + <xs:choice> + <xs:element ref="element"/> + <xs:element ref="one-to-many"/> + <xs:element ref="many-to-many"/> + <xs:element ref="composite-element"/> + <xs:element ref="many-to-any"/> + </xs:choice> + </xs:sequence> + <xs:attributeGroup ref="baseAssociationAttributes"/> + <xs:attribute name="order-by" type="xs:string"/> + </xs:complexType> + </xs:element> <xs:element name="set"> <xs:complexType> *************** *** 788,801 **** </xs:choice> </xs:sequence> ! <xs:attribute name="name" type="xs:string" use="required"/> ! <xs:attribute name="access" type="propertyAccess"/> ! <xs:attribute name="table" type="xs:string"/> ! <xs:attribute name="schema" type="xs:string"/> ! <xs:attribute name="lazy" type="xs:boolean" default="false"/> <xs:attribute name="sort" type="xs:string" default="unsorted"/> ! <xs:attribute name="inverse" type="xs:boolean" default="false"/> ! <xs:attribute name="cascade" type="cascadeStyle"/> <xs:attribute name="order-by" type="xs:string"/> ! <xs:attribute name="where" type="xs:string"/> </xs:complexType> </xs:element> --- 745,776 ---- </xs:choice> </xs:sequence> ! <xs:attributeGroup ref="baseAssociationAttributes"/> ! <xs:attribute name="order-by" type="xs:string"/> <xs:attribute name="sort" type="xs:string" default="unsorted"/> ! </xs:complexType> ! </xs:element> ! <xs:element name="map"> ! <xs:complexType> ! <xs:sequence> ! <xs:element ref="meta" minOccurs="0" maxOccurs="unbounded"/> ! <xs:element ref="jcs-cache" minOccurs="0"/> ! <xs:element ref="key"/> ! <xs:choice> ! <xs:element ref="index"/> ! <xs:element ref="composite-index"/> ! <xs:element ref="index-many-to-many"/> ! <xs:element ref="index-many-to-any"/> ! </xs:choice> ! <xs:choice> ! <xs:element ref="element"/> ! <xs:element ref="one-to-many"/> ! <xs:element ref="many-to-many"/> ! <xs:element ref="composite-element"/> ! <xs:element ref="many-to-any"/> ! </xs:choice> ! </xs:sequence> ! <xs:attributeGroup ref="baseAssociationAttributes"/> <xs:attribute name="order-by" type="xs:string"/> ! <xs:attribute name="sort" type="xs:string" default="unsorted"/> </xs:complexType> </xs:element> |
From: John M. <joh...@us...> - 2005-03-23 00:39:45
|
Update of /cvsroot/nhibernate/NHibernateContrib/src/NHibernate.Tool.Net2Hbm In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3700/src/NHibernate.Tool.Net2Hbm Modified Files: ClassPolymorphismType.cs IdAttribute.cs ListAttribute.cs ManyToOneAttribute.cs MapGenerator.cs PropertyAttribute.cs SetAttribute.cs VersionAttribute.cs Log Message: Added more support for the access strategy in NHibernate. Fixed an issue with recursive type walking. Index: ListAttribute.cs =================================================================== RCS file: /cvsroot/nhibernate/NHibernateContrib/src/NHibernate.Tool.Net2Hbm/ListAttribute.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ListAttribute.cs 30 Dec 2004 16:54:02 -0000 1.1 --- ListAttribute.cs 23 Mar 2005 00:39:35 -0000 1.2 *************** *** 17,20 **** --- 17,21 ---- private CascadeType m_Cascade = CascadeType.None; private string m_SqlWhere; + private string m_Access = MapGenerator.DefaultAccessStrategy; #endregion *************** *** 81,84 **** --- 82,103 ---- set { m_SqlWhere = value; } } + + /// <summary> + /// Gets and sets the Access. + /// </summary> + public string Access + { + get { return m_Access; } + set { m_Access = value; } + } + + /// <summary> + /// Get and sets the access type. + /// </summary> + public Type AccessType + { + get { return Type.GetType( m_Access ); } + set { m_Access = String.Format( "{0}, {1}", value.FullName, value.Assembly.GetName().Name ); } + } } } Index: PropertyAttribute.cs =================================================================== RCS file: /cvsroot/nhibernate/NHibernateContrib/src/NHibernate.Tool.Net2Hbm/PropertyAttribute.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PropertyAttribute.cs 13 Feb 2005 03:40:44 -0000 1.2 --- PropertyAttribute.cs 23 Mar 2005 00:39:35 -0000 1.3 *************** *** 13,17 **** private string m_Column; private System.Type m_Type; ! private string m_Access = "property"; private bool m_Update = true; private bool m_Insert = true; --- 13,17 ---- private string m_Column; private System.Type m_Type; ! private string m_Access = MapGenerator.DefaultAccessStrategy; private bool m_Update = true; private bool m_Insert = true; *************** *** 104,107 **** --- 104,116 ---- /// <summary> + /// Get and sets the access type. + /// </summary> + public Type AccessType + { + get { return Type.GetType( m_Access ); } + set { m_Access = String.Format( "{0}, {1}", value.FullName, value.Assembly.GetName().Name ); } + } + + /// <summary> /// Gets and sets the Column. /// </summary> Index: IdAttribute.cs =================================================================== RCS file: /cvsroot/nhibernate/NHibernateContrib/src/NHibernate.Tool.Net2Hbm/IdAttribute.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** IdAttribute.cs 13 Feb 2005 03:40:44 -0000 1.2 --- IdAttribute.cs 23 Mar 2005 00:39:35 -0000 1.3 *************** *** 12,16 **** private string m_Column; ! private string m_Access = "property"; private UnsavedValueType m_UnsavedValueType = UnsavedValueType.Null; private string m_UnsavedValue; --- 12,16 ---- private string m_Column; ! private string m_Access = MapGenerator.DefaultAccessStrategy; private UnsavedValueType m_UnsavedValueType = UnsavedValueType.Null; private string m_UnsavedValue; *************** *** 47,50 **** --- 47,59 ---- /// <summary> + /// Get and sets the access type. + /// </summary> + public Type AccessType + { + get { return Type.GetType( m_Access ); } + set { m_Access = String.Format( "{0}, {1}", value.FullName, value.Assembly.GetName().Name ); } + } + + /// <summary> /// Gets and sets the UnsavedValueType. /// </summary> Index: ClassPolymorphismType.cs =================================================================== RCS file: /cvsroot/nhibernate/NHibernateContrib/src/NHibernate.Tool.Net2Hbm/ClassPolymorphismType.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ClassPolymorphismType.cs 30 Dec 2004 16:54:02 -0000 1.1 --- ClassPolymorphismType.cs 23 Mar 2005 00:39:35 -0000 1.2 *************** *** 1,3 **** --- 1,4 ---- using System; + using System.Xml.Serialization; namespace NHibernate.Tool.Net2Hbm *************** *** 8,12 **** --- 9,16 ---- public enum ClassPolymorphismType { + [XmlEnum("implicit")] Implicit = 0, + + [XmlEnum("explicit")] Explicit = 1 } Index: ManyToOneAttribute.cs =================================================================== RCS file: /cvsroot/nhibernate/NHibernateContrib/src/NHibernate.Tool.Net2Hbm/ManyToOneAttribute.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ManyToOneAttribute.cs 30 Dec 2004 16:54:02 -0000 1.1 --- ManyToOneAttribute.cs 23 Mar 2005 00:39:35 -0000 1.2 *************** *** 18,21 **** --- 18,22 ---- private CascadeType m_Cascade; private bool m_Inheritable = true; + private string m_Access = MapGenerator.DefaultAccessStrategy; #endregion *************** *** 109,112 **** --- 110,130 ---- } + /// <summary> + /// Gets and sets the Access. + /// </summary> + public string Access + { + get { return m_Access; } + set { m_Access = value; } + } + + /// <summary> + /// Get and sets the access type. + /// </summary> + public Type AccessType + { + get { return Type.GetType( m_Access ); } + set { m_Access = String.Format( "{0}, {1}", value.FullName, value.Assembly.GetName().Name ); } + } } } Index: MapGenerator.cs =================================================================== RCS file: /cvsroot/nhibernate/NHibernateContrib/src/NHibernate.Tool.Net2Hbm/MapGenerator.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** MapGenerator.cs 13 Feb 2005 03:40:44 -0000 1.4 --- MapGenerator.cs 23 Mar 2005 00:39:35 -0000 1.5 *************** *** 14,22 **** public sealed class MapGenerator { #region Member Variables private SortedList m_Types; - private Regex m_AssemblyQualifiedNameRegex; - private const string AssemblyQualifiedPattern = @"^(?<type>[\w\.\[\]]+),\s(?<assembly>[\w\.]+),\sVersion=(?<version>[\d\.]+),\sCulture=(?<culture>[\w\.]+),\sPublicKeyToken=(?<key>[\w]+)$"; #endregion --- 14,26 ---- public sealed class MapGenerator { + #region Constants + + public const string DefaultAccessStrategy = "property"; + + #endregion + #region Member Variables private SortedList m_Types; #endregion *************** *** 28,32 **** { m_Types = new SortedList(); - m_AssemblyQualifiedNameRegex = new Regex( MapGenerator.AssemblyQualifiedPattern, RegexOptions.None ); } --- 32,35 ---- *************** *** 145,151 **** /// <param name="writer"></param> /// <param name="type"></param> ! private void WriteCollections( XmlWriter writer, System.Type type, bool declaredOnly ) { ! PropertyInfo[] listProps = FindAttributedProperties( typeof(ListAttribute), type, declaredOnly ); foreach( PropertyInfo listProp in listProps ) { --- 148,154 ---- /// <param name="writer"></param> /// <param name="type"></param> ! private void WriteCollections( XmlWriter writer, System.Type type ) { ! PropertyInfo[] listProps = FindAttributedProperties( typeof(ListAttribute), type ); foreach( PropertyInfo listProp in listProps ) { *************** *** 153,157 **** } ! PropertyInfo[] setProps = FindAttributedProperties( typeof(SetAttribute), type, declaredOnly ); foreach( PropertyInfo setProp in setProps ) { --- 156,160 ---- } ! PropertyInfo[] setProps = FindAttributedProperties( typeof(SetAttribute), type ); foreach( PropertyInfo setProp in setProps ) { *************** *** 172,175 **** --- 175,179 ---- writer.WriteAttributeString( "name", property.Name ); writer.WriteAttributeString( "table", attribute.Table ); + writer.WriteAttributeString( "access", attribute.Access ); if( attribute.IsLazy ) writer.WriteAttributeString( "lazy", "true" ); if( attribute.IsInverse ) writer.WriteAttributeString( "inverse", "true" ); *************** *** 193,196 **** --- 197,201 ---- writer.WriteAttributeString( "name", property.Name ); writer.WriteAttributeString( "table", attribute.Table ); + writer.WriteAttributeString( "access", attribute.Access ); if( attribute.IsLazy ) writer.WriteAttributeString( "lazy", "true" ); WriteCollectionKey( writer, property ); *************** *** 265,269 **** writer.WriteStartElement( "composite-element" ); writer.WriteAttributeString( "class", GetShortTypeName( attribute.Type ) ); ! WriteProperties( writer, attribute.Type, false ); writer.WriteEndElement(); //</composite-element> } --- 270,274 ---- writer.WriteStartElement( "composite-element" ); writer.WriteAttributeString( "class", GetShortTypeName( attribute.Type ) ); ! WriteProperties( writer, attribute.Type ); writer.WriteEndElement(); //</composite-element> } *************** *** 321,327 **** writer.WriteAttributeString( "dynamic-update", "true" ); ! WriteProperties( writer, type, true ); ! WriteCollections( writer, type, true ); ! WriteAssociations( writer, type, true ); foreach( TypeNode childNode in node.Nodes ) --- 326,332 ---- writer.WriteAttributeString( "dynamic-update", "true" ); ! WriteProperties( writer, type ); ! WriteCollections( writer, type ); ! WriteAssociations( writer, type ); foreach( TypeNode childNode in node.Nodes ) *************** *** 343,346 **** --- 348,354 ---- writer.WriteAttributeString( "table", attribute.Table ); + if( attribute.Polymorphism != ClassPolymorphismType.Implicit ) + writer.WriteAttributeString( "polymorphism", GetXmlEnumValue( typeof(ClassPolymorphismType), attribute.Polymorphism ) ); + if( attribute.DiscriminatorValue != null ) writer.WriteAttributeString( "discriminator-value", attribute.DiscriminatorValue ); *************** *** 352,358 **** WriteDiscriminator( writer, type ); WriteVersion( writer, type ); ! WriteProperties( writer, type, false ); ! WriteCollections( writer, type, false ); ! WriteAssociations( writer, type, false ); foreach( TypeNode childNode in node.Nodes ) --- 360,366 ---- WriteDiscriminator( writer, type ); WriteVersion( writer, type ); ! WriteProperties( writer, type ); ! WriteCollections( writer, type ); ! WriteAssociations( writer, type ); foreach( TypeNode childNode in node.Nodes ) *************** *** 409,415 **** /// <param name="writer"></param> /// <param name="parentNode"></param> ! private void WriteProperties( XmlWriter writer, System.Type type, bool declaredOnly ) { ! PropertyInfo[] properties = FindAttributedProperties( typeof(PropertyAttribute), type, declaredOnly ); foreach( PropertyInfo property in properties ) { --- 417,423 ---- /// <param name="writer"></param> /// <param name="parentNode"></param> ! private void WriteProperties( XmlWriter writer, System.Type type ) { ! PropertyInfo[] properties = FindAttributedProperties( typeof(PropertyAttribute), type ); foreach( PropertyInfo property in properties ) { *************** *** 423,429 **** /// <param name="writer"></param> /// <param name="type"></param> ! private void WriteAssociations( XmlWriter writer, System.Type type, bool declaredOnly ) { ! PropertyInfo[] properties = FindAttributedProperties( typeof(ManyToOneAttribute), type, declaredOnly ); foreach( PropertyInfo property in properties ) { --- 431,437 ---- /// <param name="writer"></param> /// <param name="type"></param> ! private void WriteAssociations( XmlWriter writer, System.Type type ) { ! PropertyInfo[] properties = FindAttributedProperties( typeof(ManyToOneAttribute), type ); foreach( PropertyInfo property in properties ) { *************** *** 445,449 **** writer.WriteAttributeString( "name", property.Name ); writer.WriteAttributeString( "column", attribute.Column == null ? property.Name : attribute.Column ); ! string typeName = null; if( attribute.Type != null ) --- 453,458 ---- writer.WriteAttributeString( "name", property.Name ); writer.WriteAttributeString( "column", attribute.Column == null ? property.Name : attribute.Column ); ! writer.WriteAttributeString( "access", attribute.Access ); ! string typeName = null; if( attribute.Type != null ) *************** *** 485,488 **** --- 494,498 ---- writer.WriteAttributeString( "column", attribute.Column ); writer.WriteAttributeString( "type", GetShortTypeName( property.PropertyType ) ); + writer.WriteAttributeString( "access", attribute.Access ); writer.WriteEndElement(); //</version> } *************** *** 545,551 **** writer.WriteAttributeString( "table", attribute.Table ); WriteJoinedSubclassKey( writer, type ); ! WriteProperties( writer, type, true ); ! WriteCollections( writer, type, true ); ! WriteAssociations( writer, type, true ); foreach( TypeNode childNode in node.Nodes ) --- 555,561 ---- writer.WriteAttributeString( "table", attribute.Table ); WriteJoinedSubclassKey( writer, type ); ! WriteProperties( writer, type ); ! WriteCollections( writer, type ); ! WriteAssociations( writer, type ); foreach( TypeNode childNode in node.Nodes ) *************** *** 608,618 **** { System.Type type = classType; ! while( ( type == classType ) || ! ( ( type != null ) && ! ( !type.IsDefined( typeof(ClassAttribute), false ) ) && ! ( !type.IsDefined( typeof(SubclassAttribute), false ) ) && ! ( !type.IsDefined( typeof(JoinedSubclassAttribute), false ) ) ) ) { ! PropertyInfo[] properties = type.GetProperties( BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic ); foreach( PropertyInfo property in properties ) { --- 618,624 ---- { System.Type type = classType; ! while( ( type == classType ) || ( type != null ) ) { ! PropertyInfo[] properties = type.GetProperties( BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.DeclaredOnly ); foreach( PropertyInfo property in properties ) { *************** *** 633,648 **** /// <param name="classType"></param> /// <returns></returns> ! private PropertyInfo[] FindAttributedProperties( System.Type attrType, System.Type classType, bool declaredOnly ) { ArrayList list = new ArrayList(); ! BindingFlags bindings = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; ! /*if( declaredOnly )*/ bindings = bindings | BindingFlags.DeclaredOnly; System.Type type = classType; ! while( ( type == classType ) || ! ( ( type != null ) && ! ( !type.IsDefined( typeof(ClassAttribute), false ) ) && ! ( !type.IsDefined( typeof(SubclassAttribute), false ) ) && ! ( !type.IsDefined( typeof(JoinedSubclassAttribute), false ) ) ) ) { PropertyInfo[] properties = type.GetProperties( bindings ); --- 639,649 ---- /// <param name="classType"></param> /// <returns></returns> ! private PropertyInfo[] FindAttributedProperties( System.Type attrType, System.Type classType ) { ArrayList list = new ArrayList(); ! BindingFlags bindings = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.DeclaredOnly; System.Type type = classType; ! while( ( type == classType ) || ( type != null ) ) { PropertyInfo[] properties = type.GetProperties( bindings ); *************** *** 669,675 **** private string GetShortTypeName( System.Type type ) { ! Match name = m_AssemblyQualifiedNameRegex.Match( type.AssemblyQualifiedName ); ! string typeName = name.Groups["type"].Value; ! string assemblyName = name.Groups["assembly"].Value; if( assemblyName == "mscorlib" && --- 670,675 ---- private string GetShortTypeName( System.Type type ) { ! string typeName = type.FullName; ! string assemblyName = type.Assembly.GetName().Name; if( assemblyName == "mscorlib" && Index: SetAttribute.cs =================================================================== RCS file: /cvsroot/nhibernate/NHibernateContrib/src/NHibernate.Tool.Net2Hbm/SetAttribute.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SetAttribute.cs 30 Dec 2004 16:54:02 -0000 1.1 --- SetAttribute.cs 23 Mar 2005 00:39:35 -0000 1.2 *************** *** 16,19 **** --- 16,20 ---- private CascadeType m_Cascade = CascadeType.None; private string m_SqlWhere; + private string m_Access = MapGenerator.DefaultAccessStrategy; #endregion *************** *** 47,51 **** /// <summary> /// Gets and sets the IsLazy. ! /// </summary> public bool IsLazy { --- 48,52 ---- /// <summary> /// Gets and sets the IsLazy. ! /// </summary public bool IsLazy { *************** *** 71,74 **** --- 72,93 ---- set { m_SqlWhere = value; } } + + /// <summary> + /// Gets and sets the Access. + /// </summary> + public string Access + { + get { return m_Access; } + set { m_Access = value; } + } + + /// <summary> + /// Get and sets the access type. + /// </summary> + public Type AccessType + { + get { return Type.GetType( m_Access ); } + set { m_Access = String.Format( "{0}, {1}", value.FullName, value.Assembly.GetName().Name ); } + } } } Index: VersionAttribute.cs =================================================================== RCS file: /cvsroot/nhibernate/NHibernateContrib/src/NHibernate.Tool.Net2Hbm/VersionAttribute.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** VersionAttribute.cs 30 Dec 2004 16:54:02 -0000 1.1 --- VersionAttribute.cs 23 Mar 2005 00:39:35 -0000 1.2 *************** *** 12,16 **** private string m_Column; ! #endregion --- 12,17 ---- private string m_Column; ! private string m_Access = MapGenerator.DefaultAccessStrategy; ! #endregion *************** *** 31,34 **** --- 32,53 ---- set { m_Column = value; } } + + /// <summary> + /// Gets and sets the Access. + /// </summary> + public string Access + { + get { return m_Access; } + set { m_Access = value; } + } + + /// <summary> + /// Get and sets the access type. + /// </summary> + public Type AccessType + { + get { return Type.GetType( m_Access ); } + set { m_Access = String.Format( "{0}, {1}", value.FullName, value.Assembly.GetName().Name ); } + } } } |
From: Paul H. <pha...@us...> - 2005-03-21 12:23:35
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.DomainModel In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29287/nhibernate/src/NHibernate.DomainModel Added Files: SubComponent.cs Log Message: NH-204: Test code for SQL queries --- NEW FILE: SubComponent.cs --- using System; namespace NHibernate.DomainModel { /// <summary> /// Summary description for SubComponent. /// </summary> public class SubComponent { private string _subName; private string _subName1; public SubComponent() { } public string SubName { get { return _subName; } set { _subName = value; } } public string SubName1 { get { return _subName1; } set { _subName1 = value; } } } } |
From: Paul H. <pha...@us...> - 2005-03-21 12:22:55
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.DomainModel In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28800/nhibernate/src/NHibernate.DomainModel Modified Files: NHibernate.DomainModel-1.1.csproj Added Files: Component.cs Componentizable.cs Componentizable.hbm.xml Log Message: NH-204 : Test code for SQL queries --- NEW FILE: Componentizable.cs --- using System; namespace NHibernate.DomainModel { /// <summary> /// Summary description for Componentizable. /// </summary> public class Componentizable { private int _id; public string _nickName; private Component _component; public Componentizable() { } public int Id { get { return _id; } set { _id = value; } } public Component Component { get { return _component; } set { _component = value; } } public string NickName { get { return _nickName; } set { _nickName = value; } } } } --- NEW FILE: Componentizable.hbm.xml --- <?xml version="1.0" encoding="UTF-8"?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.0" namespace="NHibernate.DomainModel" assembly="NHibernate.Test"> <class name="NHibernate.DomainModel.Componentizable"> <id name="id"> <generator class="native"/> </id> <property name="nickName"/> <component name="component" access="property" class="NHibernate.DomainModel.Component"> <property name="name"/> <component name="subComponent" class="NHibernate.DomainModel.SubComponent"> <property name="subName"/> <property name="subName1"/> </component> </component> </class> </hibernate-mapping> Index: NHibernate.DomainModel-1.1.csproj =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.DomainModel/NHibernate.DomainModel-1.1.csproj,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** NHibernate.DomainModel-1.1.csproj 10 Feb 2005 17:47:58 -0000 1.30 --- NHibernate.DomainModel-1.1.csproj 21 Mar 2005 12:22:36 -0000 1.31 *************** *** 199,202 **** --- 199,207 ---- /> <File + RelPath = "Component.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "ComponentCollection.cs" SubType = "Code" *************** *** 204,207 **** --- 209,221 ---- /> <File + RelPath = "Componentizable.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "Componentizable.hbm.xml" + BuildAction = "EmbeddedResource" + /> + <File RelPath = "CompositeElement.cs" SubType = "Code" *************** *** 551,554 **** --- 565,573 ---- /> <File + RelPath = "SubComponent.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "SubDetail.cs" SubType = "Code" --- NEW FILE: Component.cs --- using System; namespace NHibernate.DomainModel { /// <summary> /// Summary description for Component. /// </summary> public class Component { private string _name; private SubComponent _subComponent; public Component() { } public string Name { get { return _name; } set { _name = value; } } public SubComponent SubComponent { get { return _subComponent; } set { _subComponent = value; } } } } |
From: Paul H. <pha...@us...> - 2005-03-21 12:11:56
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23634/nhibernate/src/NHibernate.Test Modified Files: NHibernate.Test-1.1.csproj Added Files: SQLLoaderTest.cs Log Message: Index: NHibernate.Test-1.1.csproj =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/NHibernate.Test-1.1.csproj,v retrieving revision 1.66 retrieving revision 1.67 diff -C2 -d -r1.66 -r1.67 *** NHibernate.Test-1.1.csproj 15 Mar 2005 14:08:12 -0000 1.66 --- NHibernate.Test-1.1.csproj 21 Mar 2005 12:11:46 -0000 1.67 *************** *** 201,204 **** --- 201,209 ---- /> <File + RelPath = "SQLLoaderTest.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "TestCase.cs" SubType = "Code" *************** *** 226,229 **** --- 231,239 ---- /> <File + RelPath = "CfgTest\DefaultNsAssmFixture.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "CfgTest\HbmOrderingFixture.cs" SubType = "Code" *************** *** 443,446 **** --- 453,461 ---- /> <File + RelPath = "NHSpecificTest\CollectionFixture.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "NHSpecificTest\GetTest.cs" SubType = "Code" *************** *** 473,476 **** --- 488,496 ---- /> <File + RelPath = "NHSpecificTest\SimpleFooBarFixture.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "NHSpecificTest\UnsavedValueFixture.cs" SubType = "Code" --- NEW FILE: SQLLoaderTest.cs --- using System; using System.Collections; using NHibernate.DomainModel; using NUnit.Framework; namespace NHibernate.Test { /// <summary> /// Summary description for SQLLoaderTest. /// </summary> [TestFixture] public class SQLLoaderTest : TestCase { #region NUnit.Framework.TestFixture Members [TestFixtureSetUp] public void TestFixtureSetUp() { ExportSchema( new string[] { "ABC.hbm.xml", "Category.hbm.xml", "Simple.hbm.xml", "Fo.hbm.xml", "SingleSeveral.hbm.xml", "Componentizable.hbm.xml" } ); } [SetUp] public void SetUp() { // there are test in here where we don't need to resetup the // tables - so only set the tables up once } [TearDown] public override void TearDown() { // do nothing except not let the base TearDown get called } [TestFixtureTearDown] public void TestFixtureTearDown() { base.TearDown(); } #endregion static int nextInt = 1; static long nextLong = 1; [Test] public void TestTS() { /* if ( Dialect is NHibernate.Dialect.Oracle9Dialect ) { return; } */ ISession session = sessions.OpenSession(); Simple sim = new Simple(); sim.Date = DateTime.Now; session.Save( sim, 1 ); IQuery q = session.CreateSQLQuery( "select {sim.*} from Simple {sim} where {sim}.date_ = ?", "sim", typeof( Simple ) ); q.SetTimestamp( 0, sim.Date ); Assert.AreEqual( 1, q.List().Count, "q.List.Count"); session.Delete( sim ); session.Flush(); session.Close(); } [Test] [Ignore("Test not written")] public void TestFindBySQLStar() { } [Test] [Ignore("Test not written")] public void TestFindBySQLProperties() { } [Test] [Ignore("Test not written")] public void TestFindBySQLAssociatedObject() { } [Test] [Ignore("Test not written")] public void TestFindBySQLMultipleObject() { } [Test] [Ignore("Test not written")] public void TestFindBySQLParameters() { } [Test] [Ignore("Test not written")] public void TestEscapedODBC() { } [Test] [Ignore("Test not written")] public void TestDoubleAliasing() { } [Test] [Ignore("Test not written")] public void TestEmbeddedCompositeProperties() { } [Test] [Ignore("Test not written")] public void TestComponentStar() { } [Test] [Ignore("Test not written")] public void TestComponentNoStar() { } private void ComponentTest() { } [Test] [Ignore("Test not written")] public void TestFindSimpleBySQL() { } [Test] [Ignore("Test not written")] public void TestFindBySQLSimpleByDiffSessions() { } [Test] [Ignore("Test not written")] public void TestFindBySQLDiscriminatorSameSession() { } [Test] [Ignore("Test not written")] public void TestFindBySQLDiscriminatedDiffSessions() { } [Test] [Ignore("Test not written")] public void TestNamedSQLQuery() { } } } |
From: Paul H. <pha...@us...> - 2005-03-21 12:11:55
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/MappingExceptions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23634/nhibernate/src/NHibernate.Test/MappingExceptions Modified Files: AddClassFixture.cs Log Message: Index: AddClassFixture.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/MappingExceptions/AddClassFixture.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AddClassFixture.cs 16 Dec 2004 04:55:42 -0000 1.1 --- AddClassFixture.cs 21 Mar 2005 12:11:46 -0000 1.2 *************** *** 39,47 **** Assert.AreEqual( "persistent class not found", me.Message ); } ! } ! ! ! ! } } --- 39,43 ---- Assert.AreEqual( "persistent class not found", me.Message ); } ! } } } |
From: Paul H. <pha...@us...> - 2005-03-21 11:31:47
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Cfg In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1083/nhibernate/src/NHibernate/Cfg Modified Files: AssemblyHbmOrderer.cs Binder.cs Mappings.cs Log Message: NH-185 - Default naming strategy for Classes NH-180 - Add default Namespace/Assembly to hibernate-mapping Index: Mappings.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Cfg/Mappings.cs,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Mappings.cs 1 Mar 2005 16:24:44 -0000 1.12 --- Mappings.cs 21 Mar 2005 11:31:35 -0000 1.13 *************** *** 26,29 **** --- 26,31 ---- private IList propertyReferences; private string defaultAccess; + private string @namespace; + private string assembly; private IDictionary caches; private INamingStrategy namingStrategy; *************** *** 139,142 **** --- 141,162 ---- /// <summary> + /// The default namespace for persistent classes + /// </summary> + public string Namespace + { + get { return @namespace; } + set { @namespace = value; } + } + + /// <summary> + /// The default assembly for persistent classes + /// </summary> + public string Assembly + { + get { return assembly; } + set { assembly = value; } + } + + /// <summary> /// /// </summary> Index: AssemblyHbmOrderer.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Cfg/AssemblyHbmOrderer.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AssemblyHbmOrderer.cs 21 Feb 2005 19:16:52 -0000 1.1 --- AssemblyHbmOrderer.cs 21 Mar 2005 11:31:35 -0000 1.2 *************** *** 5,8 **** --- 5,9 ---- using System.Reflection; using System.Xml; + using NHibernate.Util; namespace NHibernate.Cfg *************** *** 84,88 **** while( xmlReader.Read() ) { ! if( xmlReader.NodeType!=XmlNodeType.Element ) { continue; --- 85,89 ---- while( xmlReader.Read() ) { ! if( xmlReader.NodeType != XmlNodeType.Element ) { continue; *************** *** 92,96 **** { xmlReader.MoveToAttribute("name"); ! string className = xmlReader.Value; ClassEntry ce = new ClassEntry( null, className, fileName ); _classes.Add(ce); --- 93,97 ---- { xmlReader.MoveToAttribute("name"); ! string className = StringHelper.GetClassname( xmlReader.Value ); ClassEntry ce = new ClassEntry( null, className, fileName ); _classes.Add(ce); *************** *** 99,107 **** { xmlReader.MoveToAttribute("name"); ! string className = xmlReader.Value; if( xmlReader.MoveToAttribute("extends") ) { containsExtends = true; ! string baseClassName = xmlReader.Value; ClassEntry ce = new ClassEntry( baseClassName, className, fileName ); _classes.Add(ce); --- 100,108 ---- { xmlReader.MoveToAttribute("name"); ! string className = StringHelper.GetClassname( xmlReader.Value ); if( xmlReader.MoveToAttribute("extends") ) { containsExtends = true; ! string baseClassName = StringHelper.GetClassname( xmlReader.Value ); ClassEntry ce = new ClassEntry( baseClassName, className, fileName ); _classes.Add(ce); *************** *** 169,173 **** // base class was found - insert at the index // immediately following it ! if( sce.ClassName==ce.BaseClassName ) { insertIndex = i + 1; --- 170,174 ---- // base class was found - insert at the index // immediately following it ! if( sce.ClassName == ce.BaseClassName ) { insertIndex = i + 1; Index: Binder.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Cfg/Binder.cs,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** Binder.cs 14 Mar 2005 14:35:54 -0000 1.41 --- Binder.cs 21 Mar 2005 11:31:35 -0000 1.42 *************** *** 22,28 **** internal static Dialect.Dialect dialect; public static void BindClass(XmlNode node, PersistentClass model, Mappings mapping) { ! string className = node.Attributes["name"] == null ? null : node.Attributes["name"].Value; //CLASS --- 22,75 ---- internal static Dialect.Dialect dialect; + /// <summary> + /// Converts a partial class name into a fully qualified one + /// </summary> + /// <param name="className"></param> + /// <param name="mapping"></param> + /// <returns></returns> + public static string FullClassName( string className, Mappings mapping ) + { + if ( className == null ) + { + return null; + } + + // TODO: Make this stronger, assumes stuff about presence of culture, public key etc + // Split off the assembly reference if it's present + string[] parts = className.Split( ',' ); + string name = parts[ 0 ]; + if ( name.IndexOf( '.' ) == -1 && mapping.Namespace != null ) + { + // No namespace - use the default + name = mapping.Namespace + "." + name; + } + + string assm; + if ( parts.Length == 1 ) + { + if ( mapping.Assembly == null ) + { + // No default, let it try and find it automatically + assm = ""; + } + else + { + // No assembly - use the default + assm = ", " + mapping.Assembly; + } + } + else + { + // Use the assembly reference provided + assm = ", " + parts[ 1 ]; + } + + // Rebuild the name + return name + assm; + } + public static void BindClass(XmlNode node, PersistentClass model, Mappings mapping) { ! string className = node.Attributes["name"] == null ? null : FullClassName( node.Attributes["name"].Value, mapping ); //CLASS *************** *** 70,74 **** //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, --- 117,121 ---- //IMPORT ! // we automatically 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, *************** *** 531,535 **** try { ! model.CollectionPersisterClass = ReflectHelper.ClassForName( persisterNode.Value ); } catch (Exception) --- 578,583 ---- try { ! string persisterName = FullClassName( persisterNode.Value, mappings ); ! model.CollectionPersisterClass = ReflectHelper.ClassForName( persisterName ); } catch (Exception) *************** *** 554,558 **** XmlAttribute tableNode = node.Attributes["table"]; string tableName; ! if ( tableNode!=null) { tableName = mappings.NamingStrategy.TableName( tableNode.Value ); --- 602,606 ---- XmlAttribute tableNode = node.Attributes["table"]; string tableName; ! if ( tableNode != null ) { tableName = mappings.NamingStrategy.TableName( tableNode.Value ); *************** *** 586,599 **** { model.IsSorted = true; ! string comparatorClassName = sortedAtt.Value; if ( !comparatorClassName.Equals("natural") ) { try { ! model.Comparer = (IComparer) Activator.CreateInstance( ReflectHelper.ClassForName(comparatorClassName) ); } catch (Exception) { ! throw new MappingException("could not instantiate comparer class: " + className); } } --- 634,647 ---- { model.IsSorted = true; ! string comparatorClassName = FullClassName( sortedAtt.Value, mappings ); if ( !comparatorClassName.Equals("natural") ) { try { ! model.Comparer = (IComparer) Activator.CreateInstance( ReflectHelper.ClassForName( comparatorClassName ) ); } catch (Exception) { ! throw new MappingException( "could not instantiate comparer class: " + comparatorClassName ); } } *************** *** 827,831 **** try { ! model.ComponentClass = ReflectHelper.ClassForName( classNode.Value ) ; } catch (Exception e) --- 875,879 ---- try { ! model.ComponentClass = ReflectHelper.ClassForName( FullClassName( classNode.Value, mappings ) ) ; } catch (Exception e) *************** *** 1312,1315 **** --- 1360,1367 ---- XmlAttribute aiNode = hmNode.Attributes["auto-import"]; model.IsAutoImport = (aiNode==null) ? true : "true".Equals( aiNode.Value ); + XmlAttribute nsNode = hmNode.Attributes["namespace"]; + model.Namespace = (nsNode==null) ? null : nsNode.Value ; + XmlAttribute assemblyNode = hmNode.Attributes["assembly"]; + model.Assembly = (assemblyNode==null) ? null : assemblyNode.Value ; nsmgr = new XmlNamespaceManager(doc.NameTable); *************** *** 1378,1385 **** foreach(XmlNode n in hmNode.SelectNodes(nsPrefix + ":import", nsmgr) ) { ! string className = n.Attributes["class"].Value; ! XmlAttribute renameNode = n.Attributes["rename"]; ! string rename = (renameNode==null) ? StringHelper.GetClassname(className) : renameNode.Value; ! log.Debug("Import: " + rename + " -> " + className); model.AddImport(className, rename); } --- 1430,1437 ---- foreach(XmlNode n in hmNode.SelectNodes(nsPrefix + ":import", nsmgr) ) { ! string className = FullClassName( n.Attributes["class"].Value, model ); ! XmlAttribute renameNode = n.Attributes[ "rename" ]; ! string rename = (renameNode == null) ? StringHelper.GetClassname( className ) : renameNode.Value; ! log.Debug( "Import: " + rename + " -> " + className ); model.AddImport(className, rename); } *************** *** 1414,1423 **** private static PersistentClass GetSuperclass( Mappings model, XmlNode subnode ) { ! XmlAttribute extendsAttr = subnode.Attributes["extends"]; ! if( extendsAttr==null ) { throw new MappingException( "'extends' attribute is not found." ); } ! String extendsValue = extendsAttr.Value; System.Type superclass; try --- 1466,1475 ---- private static PersistentClass GetSuperclass( Mappings model, XmlNode subnode ) { ! XmlAttribute extendsAttr = subnode.Attributes[ "extends" ]; ! if( extendsAttr == null ) { throw new MappingException( "'extends' attribute is not found." ); } ! String extendsValue = FullClassName( extendsAttr.Value, model ); System.Type superclass; try |
From: Paul H. <pha...@us...> - 2005-03-21 11:27:13
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/CfgTest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31125/nhibernate/src/NHibernate.Test/CfgTest Added Files: DefaultNsAssmFixture.cs Log Message: NH-185 - Default naming for classes --- NEW FILE: DefaultNsAssmFixture.cs --- using System; using System.Reflection; using System.Reflection.Emit; using System.IO; using NHibernate.Cfg; using NUnit.Framework; namespace NHibernate.Test.CfgTest { /// <summary> /// Test fixture for NH-185 /// </summary> [TestFixture] public class DefaultNsAssmFixture { // Working directory private static string dir_; // Base class mapping private const string aJoinedHbmXml = @"<?xml version=""1.0"" encoding=""utf-8"" ?> <hibernate-mapping xmlns=""urn:nhibernate-mapping-2.0"" namespace=""NHibernate.Test.CfgTest"" assembly=""NHibernate.Test""> <class name=""A"" table=""A""> <id name=""Id""> <generator class=""assigned"" /> </id> </class> </hibernate-mapping>"; // Derived class mapping private const string bJoinedHbmXml = @"<?xml version=""1.0"" encoding=""utf-8"" ?> <hibernate-mapping xmlns=""urn:nhibernate-mapping-2.0"" namespace=""NHibernate.Test.CfgTest""> <joined-subclass name=""B, NHibernate.Test"" extends=""NHibernate.Test.CfgTest.A, NHibernate.Test"" table=""B""> <key column=""Id"" /> <property name=""Value"" type=""Int32"" /> </joined-subclass> </hibernate-mapping>"; // Add another level private const string cJoinedHbmXml = @"<?xml version=""1.0"" encoding=""utf-8"" ?> <hibernate-mapping xmlns=""urn:nhibernate-mapping-2.0"" assembly=""NHibernate.Test""> <joined-subclass name=""NHibernate.Test.CfgTest.C"" extends=""NHibernate.Test.CfgTest.B, NHibernate.Test"" table=""B""> <key column=""Id"" /> <property name=""Description"" type=""String"" /> </joined-subclass> </hibernate-mapping>"; private const string aSubclassHbmXml = @"<?xml version=""1.0"" encoding=""utf-8"" ?> <hibernate-mapping xmlns=""urn:nhibernate-mapping-2.0"" namespace=""NHibernate.Test.CfgTest"" assembly=""NHibernate.Test""> <class name=""A"" table=""A"" discriminator-value=""0""> <id name=""Id""> <generator class=""assigned"" /> </id> <discriminator column=""disc_col"" type=""Int32"" /> </class> </hibernate-mapping>"; // Derived class mapping private const string bSubclassHbmXml = @"<?xml version=""1.0"" encoding=""utf-8"" ?> <hibernate-mapping xmlns=""urn:nhibernate-mapping-2.0""> <joined-subclass name=""NHibernate.Test.CfgTest.B, NHibernate.Test"" extends=""NHibernate.Test.CfgTest.A, NHibernate.Test"" table=""B"" discriminator-value=""1""> <key column=""Id"" /> <property name=""Value"" type=""Int32"" /> </joined-subclass> </hibernate-mapping>"; // Add another level private const string cSubclassHbmXml = @"<?xml version=""1.0"" encoding=""utf-8"" ?> <hibernate-mapping xmlns=""urn:nhibernate-mapping-2.0"" namespace=""NHibernate.Test.CfgTest"" assembly=""NHibernate.Test""> <joined-subclass name=""NHibernate.Test.CfgTest.C, NHibernate.Test"" extends=""B"" table=""B"" discriminator-value=""2""> <key column=""Id"" /> <property name=""Description"" type=""String"" /> </joined-subclass> </hibernate-mapping>"; #region NUnit.Framework.TestFixture Members [TestFixtureSetUp] public void TestFixtureSetUp() { dir_ = Directory.GetCurrentDirectory(); // Create hbm files (ideally, we could just embed them directly into the // assembly - same as VS does when 'Build Action' = 'Embedded Resource' - but // I could not find a way to do this, so we use files instead) StreamWriter aw = new StreamWriter( "A1.hbm.xml" ); aw.Write( aJoinedHbmXml ); aw.Close(); StreamWriter bw = new StreamWriter( "B1.hbm.xml" ); bw.Write( bJoinedHbmXml ); bw.Close(); StreamWriter cw = new StreamWriter( "C1.hbm.xml" ); cw.Write( cJoinedHbmXml ); cw.Close(); StreamWriter asw = new StreamWriter( "A1.subclass.hbm.xml" ); asw.Write( aJoinedHbmXml ); asw.Close(); StreamWriter bsw = new StreamWriter( "B1.subclass.hbm.xml" ); bsw.Write( bJoinedHbmXml ); bsw.Close(); StreamWriter csw = new StreamWriter( "C1.subclass.hbm.xml" ); csw.Write( cJoinedHbmXml ); csw.Close(); } [SetUp] public virtual void SetUp() { } [TearDown] public virtual void TearDown() { } [TestFixtureTearDown] public virtual void TestFixtureTearDown() { } #endregion [Test] public void TopDownJoined() { AssemblyName assemblyName = new AssemblyName(); assemblyName.Name = "MyTestA1.dll"; AssemblyBuilder assemblyBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(assemblyName, AssemblyBuilderAccess.RunAndSave); ModuleBuilder moduleBuilder = assemblyBuilder.DefineDynamicModule(assemblyName.Name, assemblyName.Name, true); assemblyBuilder.AddResourceFile("A.hbm.xml", "A1.hbm.xml"); assemblyBuilder.AddResourceFile("B.hbm.xml", "B1.hbm.xml"); assemblyBuilder.AddResourceFile("C.hbm.xml", "C1.hbm.xml"); assemblyBuilder.Save(assemblyName.Name); Configuration cfg = new Configuration(); cfg.AddAssembly( Assembly.LoadFile(dir_ + "/" + assemblyName.Name) ); // if no exception, success } [Test] public void BottomUpJoined() { AssemblyName assemblyName = new AssemblyName(); assemblyName.Name = "MyTestB1.dll"; AssemblyBuilder assemblyBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(assemblyName, AssemblyBuilderAccess.RunAndSave); ModuleBuilder moduleBuilder = assemblyBuilder.DefineDynamicModule(assemblyName.Name, assemblyName.Name, true); assemblyBuilder.AddResourceFile("C.hbm.xml", "C1.hbm.xml"); assemblyBuilder.AddResourceFile("B.hbm.xml", "B1.hbm.xml"); assemblyBuilder.AddResourceFile("A.hbm.xml", "A1.hbm.xml"); assemblyBuilder.Save(assemblyName.Name); Configuration cfg = new Configuration(); cfg.AddAssembly( Assembly.LoadFile(dir_ + "/" + assemblyName.Name) ); // if no exception, success } [Test] public void MixedJoined() { AssemblyName assemblyName = new AssemblyName(); assemblyName.Name = "MyTestC1.dll"; AssemblyBuilder assemblyBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(assemblyName, AssemblyBuilderAccess.RunAndSave); ModuleBuilder moduleBuilder = assemblyBuilder.DefineDynamicModule(assemblyName.Name, assemblyName.Name, true); assemblyBuilder.AddResourceFile("B.hbm.xml", "B1.hbm.xml"); assemblyBuilder.AddResourceFile("A.hbm.xml", "A1.hbm.xml"); assemblyBuilder.AddResourceFile("C.hbm.xml", "C1.hbm.xml"); assemblyBuilder.Save(assemblyName.Name); Configuration cfg = new Configuration(); cfg.AddAssembly( Assembly.LoadFile(dir_ + "/" + assemblyName.Name) ); // if no exception, success } [Test] public void MixedSubclass() { AssemblyName assemblyName = new AssemblyName(); assemblyName.Name = "MyTestCSubclass1.dll"; AssemblyBuilder assemblyBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(assemblyName, AssemblyBuilderAccess.RunAndSave); ModuleBuilder moduleBuilder = assemblyBuilder.DefineDynamicModule(assemblyName.Name, assemblyName.Name, true); assemblyBuilder.AddResourceFile("B.subclass.hbm.xml", "B1.hbm.xml"); assemblyBuilder.AddResourceFile("A.subclass.hbm.xml", "A1.hbm.xml"); assemblyBuilder.AddResourceFile("C.subclass.hbm.xml", "C1.hbm.xml"); assemblyBuilder.Save(assemblyName.Name); Configuration cfg = new Configuration(); cfg.AddAssembly( Assembly.LoadFile(dir_ + "/" + assemblyName.Name) ); // if no exception, success } } } |
From: Paul H. <pha...@us...> - 2005-03-18 23:33:33
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv439/nhibernate/src/NHibernate/Impl Modified Files: SessionImpl.cs Log Message: Revised ISession to comply with 2.1 Index: SessionImpl.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl/SessionImpl.cs,v retrieving revision 1.74 retrieving revision 1.75 diff -C2 -d -r1.74 -r1.75 *** SessionImpl.cs 16 Mar 2005 15:10:47 -0000 1.74 --- SessionImpl.cs 18 Mar 2005 23:33:19 -0000 1.75 *************** *** 5111,5114 **** --- 5111,5135 ---- /// /// </summary> + /// <param name="obj"></param> + /// <returns></returns> + public object SavOrUpdateCopy( object obj ) + { + return SaveOrUpdateCopy( obj, null ); + } + + /// <summary> + /// + /// </summary> + /// <param name="obj"></param> + /// <param name="id"></param> + /// <returns></returns> + public object SaveOrUpdateCopy( object obj, object id ) + { + return DoCopy( obj, id, new Hashtable( 10 ) ); + } + + /// <summary> + /// + /// </summary> /// <param name="collectionPersister"></param> /// <param name="id"></param> *************** *** 5290,5293 **** --- 5311,5386 ---- /// /// </summary> + /// <param name="obj"></param> + /// <param name="replicationMode"></param> + public void Replicate( object obj, ReplicationMode replicationMode ) + { + if ( obj == null ) + { + throw new NullReferenceException( "attempt to replicate null" ); + } + + if ( ReassociateIfUninitializedProxy( obj ) ) + { + return; + } + + object theObj = UnproxyAndReassociate( obj ); + + if ( IsEntryFor( theObj ) ) + { + return; + } + + IClassPersister persister = GetPersister( theObj ); + if ( persister.IsUnsaved( theObj ) ) + { + //TODO: generate a new id value for brand new objects + throw new TransientObjectException( "unsaved object passed to Replicate()" ); + } + + object id = persister.GetIdentifier( theObj ); + object oldVersion; + if ( replicationMode == ReplicationMode.Exception ) + { + //always do an INSERT, and let it fail by constraint violation + oldVersion = null; + } + else + { + //what is the version on the database? + oldVersion = persister.CurrentVersion( id, this ); + } + + if( oldVersion != null ) + { + // existing row - do an update if appropriate + if ( replicationMode.ShouldOverwriteCurrentVersion( theObj, oldVersion, persister.GetVersion( obj ), persister.VersionType ) ) + { + //will result in a SQL UPDATE: + DoReplicate( theObj, id, oldVersion, replicationMode, persister ); + } + //else do nothing (don't even reassociate object!) + //TODO: would it be better to do a refresh from db? + } + else + { + // no existing row - do an insert + bool regenerate = persister.IsIdentifierAssignedByInsert; // prefer re-generation of identity! + DoSave( + theObj, + regenerate ? null : new Key( id, persister ), + persister, + true, //!persister.isUnsaved(object), //TODO: Do an ordinary save in the case of an "unsaved" object + // TODO: currently ignores interceptor definition of isUnsaved() + regenerate, + Cascades.CascadingAction.ActionReplicate, // not quite an ordinary save(), since we cascade back to replicate() + replicationMode + ); + } + } + + /// <summary> + /// + /// </summary> /// <param name="key"></param> public void AddNonExist( Key key ) |
From: Paul H. <pha...@us...> - 2005-03-18 23:33:28
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv439/nhibernate/src/NHibernate Modified Files: ISession.cs Log Message: Revised ISession to comply with 2.1 Index: ISession.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/ISession.cs,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** ISession.cs 11 Feb 2005 21:26:21 -0000 1.14 --- ISession.cs 18 Mar 2005 23:33:19 -0000 1.15 *************** *** 214,217 **** --- 214,225 ---- /// <summary> + /// Persist all reachable transient objects, reusing the current identifier + /// values. Note that this will not trigger the Interceptor of the Session. + /// </summary> + /// <param name="obj"></param> + /// <param name="replicationMode"></param> + void Replicate( object obj, ReplicationMode replicationMode ); + + /// <summary> /// Persist the given transient instance, first assigning a generated identifier. /// </summary> *************** *** 264,267 **** --- 272,300 ---- /// <summary> + /// Copy the state of the given object onto the persistent object with the same + /// identifier. If there is no persistent instance currently associated with + /// the session, it will be loaded. Return the persistent instance. If the + /// given instance is unsaved or does not exist in the database, save it and + /// return it as a newly persistent instance. Otherwise, the given instance + /// does not become associated with the session. + /// </summary> + /// <param name="obj">a transient instance with state to be copied</param> + /// <returns>an updated persistent instance</returns> + object SaveOrUpdateCopy( object obj ); + + /// <summary> + /// Copy the state of the given object onto the persistent object with the + /// given identifier. If there is no persistent instance currently associated + /// with the session, it will be loaded. Return the persistent instance. If + /// there is no database row with the given identifier, save the given instance + /// and return it as a newly persistent instance. Otherwise, the given instance + /// does not become associated with the session. + /// </summary> + /// <param name="obj">a persistent or transient instance with state to be copied</param> + /// <param name="id">the identifier of the instance to copy to</param> + /// <returns>an updated persistent instance</returns> + object SaveOrUpdateCopy( object obj, object id ); + + /// <summary> /// Remove a persistent instance from the datastore. /// </summary> *************** *** 507,511 **** /// <summary> ! /// Obtain an instance of <c>Query</c> for a named query string defined in the /// mapping file. /// </summary> --- 540,544 ---- /// <summary> ! /// Obtain an instance of <c>IQuery</c> for a named query string defined in the /// mapping file. /// </summary> *************** *** 513,516 **** --- 546,567 ---- /// <returns>A queru</returns> IQuery GetNamedQuery( string queryName ); + + /// <summary> + /// Create a new instance of <c>IQuery</c> for the given SQL string. + /// </summary> + /// <param name="sql">a query expressed in SQL</param> + /// <param name="returnAlias">a table alias that appears inside <tt>{}</tt> in the SQL string</param> + /// <param name="returnClass">the returned persistent class</param> + /// <returns></returns> + IQuery CreateSQLQuery( string sql, string returnAlias, System.Type returnClass ); + + /// <summary> + /// Create a new instance of <tt>Query</tt> for the given SQL string. + /// </summary> + /// <param name="sql">a query expressed in SQL</param> + /// <param name="returnAliases">an array of table aliases that appear inside <tt>{}</tt> in the SQL string</param> + /// <param name="returnClasses">the returned persistent classes</param> + /// <returns></returns> + IQuery CreateSQLQuery( string sql, string[] returnAliases, System.Type[] returnClasses ); } } \ No newline at end of file |
From: Paul H. <pha...@us...> - 2005-03-18 23:32:27
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32255/nhibernate/src/NHibernate Modified Files: nhibernate-mapping-2.0.xsd Log Message: Updated Schema to remove conversion anomalies and strongly type attributes Index: nhibernate-mapping-2.0.xsd =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/nhibernate-mapping-2.0.xsd,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** nhibernate-mapping-2.0.xsd 10 Dec 2004 16:40:01 -0000 1.8 --- nhibernate-mapping-2.0.xsd 18 Mar 2005 23:32:18 -0000 1.9 *************** *** 1,35 **** ! <xs:schema targetNamespace='urn:nhibernate-mapping-2.0' xmlns='urn:nhibernate-mapping-2.0' xmlns:xs='http://www.w3.org/2001/XMLSchema'> ! <xs:element name='hibernate-mapping'> <xs:annotation> ! <xs:documentation> ! hibernate-mapping is the document root. ! </xs:documentation> </xs:annotation> <xs:complexType> <xs:sequence> ! <xs:element ref='meta' minOccurs='0' maxOccurs='unbounded' /> [...1927 lines suppressed...] <xs:choice> ! <xs:element ref="element"/> ! <xs:element ref="one-to-many"/> ! <xs:element ref="many-to-many"/> ! <xs:element ref="composite-element"/> ! <xs:element ref="many-to-any"/> </xs:choice> </xs:sequence> ! <xs:attribute name="name" type="xs:string" use="required"/> ! <xs:attribute name="access" type="propertyAccess"/> ! <xs:attribute name="table" type="xs:string"/> ! <xs:attribute name="schema" type="xs:string"/> ! <xs:attribute name="lazy" type="xs:boolean" default="false"/> ! <xs:attribute name="sort" type="xs:string" default="unsorted"/> ! <xs:attribute name="inverse" type="xs:boolean" default="false"/> ! <xs:attribute name="cascade" type="cascadeStyle"/> ! <xs:attribute name="order-by" type="xs:string"/> ! <xs:attribute name="where" type="xs:string"/> </xs:complexType> </xs:element> |
From: Paul H. <pha...@us...> - 2005-03-18 23:32:27
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/JoinedSubclass In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32255/nhibernate/src/NHibernate.Test/JoinedSubclass Modified Files: JoinedSubclass.Employee.hbm.xml JoinedSubclass.hbm.xml Log Message: Updated Schema to remove conversion anomalies and strongly type attributes Index: JoinedSubclass.hbm.xml =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/JoinedSubclass/JoinedSubclass.hbm.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** JoinedSubclass.hbm.xml 5 Jan 2005 02:44:18 -0000 1.2 --- JoinedSubclass.hbm.xml 18 Mar 2005 23:32:18 -0000 1.3 *************** *** 12,33 **** --> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.0"> ! <class ! name="NHibernate.Test.JoinedSubclass.Person, NHibernate.Test" ! table="person" ! proxy="NHibernate.Test.JoinedSubclass.Person, NHibernate.Test" ! > ! <id ! name="Id" ! type="Int32" ! unsaved-value="0" ! column="person_id" ! access="nosetter.camelcase-underscore" ! > ! <generator class="native" /> </id> ! ! <property name="Name" column="name" /> ! <property name="Sex" column="sex" /> ! <component name="Address"> <property name="Street"/> --- 12,21 ---- --> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.0"> ! <class name="NHibernate.Test.JoinedSubclass.Person, NHibernate.Test" table="person" proxy="NHibernate.Test.JoinedSubclass.Person, NHibernate.Test"> ! <id name="Id" type="Int32" unsaved-value="0" column="person_id" access="nosetter.camelcase-underscore"> ! <generator class="native"/> </id> ! <property name="Name" column="name"/> ! <property name="Sex" column="sex"/> <component name="Address"> <property name="Street"/> *************** *** 35,61 **** <property name="Country"/> </component> ! ! <joined-subclass ! name="NHibernate.Test.JoinedSubclass.Employee, NHibernate.Test" ! table="empl" ! proxy="NHibernate.Test.JoinedSubclass.Employee, NHibernate.Test" ! > <key column="person_id"/> ! <property name="Title" not-null="true" length="20"/> ! <property name="Salary" length="0"/> <many-to-one name="Manager"/> </joined-subclass> ! ! <joined-subclass ! name="NHibernate.Test.JoinedSubclass.Customer, NHibernate.Test" ! table="cust" ! proxy="NHibernate.Test.JoinedSubclass.Customer, NHibernate.Test" ! > <key column="person_id"/> <property name="Comments"/> <many-to-one name="Salesperson"/> </joined-subclass> - </class> - </hibernate-mapping> --- 23,37 ---- <property name="Country"/> </component> ! <joined-subclass name="NHibernate.Test.JoinedSubclass.Employee, NHibernate.Test" table="empl" proxy="NHibernate.Test.JoinedSubclass.Employee, NHibernate.Test"> <key column="person_id"/> ! <property name="Title" not-null="true" length="20"/> ! <property name="Salary"/> <many-to-one name="Manager"/> </joined-subclass> ! <joined-subclass name="NHibernate.Test.JoinedSubclass.Customer, NHibernate.Test" table="cust" proxy="NHibernate.Test.JoinedSubclass.Customer, NHibernate.Test"> <key column="person_id"/> <property name="Comments"/> <many-to-one name="Salesperson"/> </joined-subclass> </class> </hibernate-mapping> Index: JoinedSubclass.Employee.hbm.xml =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/JoinedSubclass/JoinedSubclass.Employee.hbm.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** JoinedSubclass.Employee.hbm.xml 5 Jan 2005 02:44:18 -0000 1.2 --- JoinedSubclass.Employee.hbm.xml 18 Mar 2005 23:32:17 -0000 1.3 *************** *** 1,3 **** ! <?xml version="1.0" encoding="utf-8" ?> <!-- This is the a mapping for the subclass in a joined-subclasses where it --- 1,3 ---- ! <?xml version="1.0" encoding="utf-8"?> <!-- This is the a mapping for the subclass in a joined-subclasses where it *************** *** 8,23 **** --> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.0"> ! ! <joined-subclass ! extends="NHibernate.Test.JoinedSubclass.Person, NHibernate.Test" ! name="NHibernate.Test.JoinedSubclass.Employee, NHibernate.Test" ! table="j_sc_one" ! proxy="NHibernate.Test.JoinedSubclass.Employee, NHibernate.Test" ! > <key column="person_id"/> ! <property name="Title" not-null="true" length="20"/> ! <property name="Salary" length="0"/> <many-to-one name="Manager"/> </joined-subclass> - </hibernate-mapping> --- 8,16 ---- --> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.0"> ! <joined-subclass extends="NHibernate.Test.JoinedSubclass.Person, NHibernate.Test" name="NHibernate.Test.JoinedSubclass.Employee, NHibernate.Test" table="j_sc_one" proxy="NHibernate.Test.JoinedSubclass.Employee, NHibernate.Test"> <key column="person_id"/> ! <property name="Title" not-null="true" length="20"/> ! <property name="Salary"/> <many-to-one name="Manager"/> </joined-subclass> </hibernate-mapping> |
From: Sergey K. <jus...@us...> - 2005-03-16 15:10:59
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Loader In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7678/src/NHibernate/Loader Modified Files: OuterJoinLoader.cs Log Message: Fixes for NH-160: * SessionImpl.DoLoad: added nonExists check * OuterJoinLoader: a small fix to make it recognize one-to-one associations correctly Index: OuterJoinLoader.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Loader/OuterJoinLoader.cs,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** OuterJoinLoader.cs 14 Mar 2005 18:53:03 -0000 1.20 --- OuterJoinLoader.cs 16 Mar 2005 15:10:49 -0000 1.21 *************** *** 572,576 **** assoc.Subalias = subalias; assoc.Owner = GetPosition( alias, associations ); ! assoc.IsOneToOne = type.IsEntityType && ( (EntityType) type).IsOneToOne && ( (EntityType) type).IsUniqueKeyReference; assoc.JoinType = joinType; --- 572,576 ---- assoc.Subalias = subalias; assoc.Owner = GetPosition( alias, associations ); ! assoc.IsOneToOne = type.IsEntityType && ( (EntityType) type).IsOneToOne; assoc.JoinType = joinType; |
From: Sergey K. <jus...@us...> - 2005-03-16 15:10:58
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7678/src/NHibernate/Impl Modified Files: SessionImpl.cs Log Message: Fixes for NH-160: * SessionImpl.DoLoad: added nonExists check * OuterJoinLoader: a small fix to make it recognize one-to-one associations correctly Index: SessionImpl.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl/SessionImpl.cs,v retrieving revision 1.73 retrieving revision 1.74 diff -C2 -d -r1.73 -r1.74 *** SessionImpl.cs 15 Mar 2005 11:56:35 -0000 1.73 --- SessionImpl.cs 16 Mar 2005 15:10:47 -0000 1.74 *************** *** 2767,2770 **** --- 2767,2773 ---- else { + // check to see if we know already that it does not exist: + if ( nonExists.Contains(key) ) return null; + // LOOK IN CACHE CacheEntry entry = persister.HasCache ? ( CacheEntry ) persister.Cache.Get( id, timestamp ) : null; |
From: Paul H. <pha...@us...> - 2005-03-15 15:25:31
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Collection In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27437/nhibernate/src/NHibernate/Collection Removed Files: CollectionPersister.cs Log Message: File now redundant due to AbstractCollectionPersister etc --- CollectionPersister.cs DELETED --- |
From: Michael D. <mik...@us...> - 2005-03-15 14:08:24
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7926 Modified Files: NHibernate.Test-1.1.csproj Log Message: added HbmOrderingFixture into csproj file. Index: NHibernate.Test-1.1.csproj =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/NHibernate.Test-1.1.csproj,v retrieving revision 1.65 retrieving revision 1.66 diff -C2 -d -r1.65 -r1.66 *** NHibernate.Test-1.1.csproj 1 Mar 2005 16:24:41 -0000 1.65 --- NHibernate.Test-1.1.csproj 15 Mar 2005 14:08:12 -0000 1.66 *************** *** 226,229 **** --- 226,234 ---- /> <File + RelPath = "CfgTest\HbmOrderingFixture.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "CompositeId\ClassWithCompositeId.cs" SubType = "Code" |
From: Michael D. <mik...@us...> - 2005-03-15 14:06:42
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Cfg In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7507/Cfg Modified Files: Configuration.cs Log Message: nh-225: simple fixes to make config from xml more flexible and null values for session-factory name safe. Index: Configuration.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Cfg/Configuration.cs,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** Configuration.cs 14 Mar 2005 14:35:54 -0000 1.34 --- Configuration.cs 15 Mar 2005 14:06:30 -0000 1.35 *************** *** 1032,1036 **** } ! XmlNode sfNode = doc.DocumentElement.SelectSingleNode( CfgNamespacePrefix + ":session-factory", CfgNamespaceMgr ); XmlAttribute name = sfNode.Attributes[ "name" ]; if( name != null ) --- 1032,1036 ---- } ! XmlNode sfNode = doc.DocumentElement.SelectSingleNode( "//" + CfgNamespacePrefix + ":session-factory", CfgNamespaceMgr ); XmlAttribute name = sfNode.Attributes[ "name" ]; if( name != null ) *************** *** 1070,1074 **** } ! log.Info( "Configured SessionFactory: " + name.Value ); log.Debug( "properties: " + properties ); --- 1070,1077 ---- } ! if( name!=null ) ! { ! log.Info( "Configured SessionFactory: " + name.Value ); ! } log.Debug( "properties: " + properties ); |
From: Sergey K. <jus...@us...> - 2005-03-15 11:56:46
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6948/src/NHibernate/Impl Modified Files: SessionImpl.cs Log Message: * NH-230 bug fix * Implemented GetFilterTranslator closer to the H2.1 implementation * Added forgotten Flush in GetTest.GetAndModify Index: SessionImpl.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl/SessionImpl.cs,v retrieving revision 1.72 retrieving revision 1.73 diff -C2 -d -r1.72 -r1.73 *** SessionImpl.cs 15 Mar 2005 08:28:47 -0000 1.72 --- SessionImpl.cs 15 Mar 2005 11:56:35 -0000 1.73 *************** *** 2938,2942 **** persister.SetPropertyValues( obj, hydratedState ); - TypeFactory.DeepCopy( hydratedState, persister.PropertyTypes, persister.PropertyUpdateability, hydratedState ); if( persister.HasCache ) --- 2938,2941 ---- *************** *** 2955,2958 **** --- 2954,2961 ---- } + // after setting values to object + TypeFactory.DeepCopy( hydratedState, persister.PropertyTypes, persister.PropertyUpdateability, hydratedState ); + e.Status = Status.Loaded; + // reentrantCallback=false; if( log.IsDebugEnabled ) *************** *** 4643,4646 **** --- 4646,4651 ---- private FilterTranslator GetFilterTranslator( object collection, string filter, QueryParameters parameters, bool scalar ) { + if( collection == null ) throw new ArgumentNullException( "collection", "null collection passed to Filter" ); + if( log.IsDebugEnabled ) { *************** *** 4649,4698 **** } ! if( !( collection is PersistentCollection ) ) ! { ! collection = GetArrayHolder( collection ); ! if( collection == null ) ! { ! throw new TransientObjectException( "collection was not yet persistent" ); ! } ! } ! ! PersistentCollection coll = ( PersistentCollection ) collection; ! CollectionEntry e = GetCollectionEntry( coll ); ! if( e == null ) ! { ! throw new TransientObjectException( "collection was not persistent in this session" ); ! } ! FilterTranslator q; ! ICollectionPersister roleBeforeFlush = e.loadedPersister; if( roleBeforeFlush == null ) ! { //ie. it was previously unreferenced Flush(); ! if( e.loadedPersister == null ) { throw new QueryException( "the collection was unreferenced" ); } ! q = factory.GetFilter( filter, e.loadedPersister.Role, scalar ); } else { ! q = factory.GetFilter( filter, roleBeforeFlush.Role, scalar ); ! if( AutoFlushIfRequired( q.QuerySpaces ) && roleBeforeFlush != e.loadedPersister ) { ! if( e.loadedPersister == null ) { ! throw new QueryException( "the collection was dereferenced" ); } ! // might need to recompile the query after the flush because the collection role may have changed. ! q = factory.GetFilter( filter, e.loadedPersister.Role, scalar ); } } ! parameters.PositionalParameterValues[ 0 ] = e.loadedKey; ! parameters.PositionalParameterTypes[ 0 ] = e.loadedPersister.KeyType; ! return q; } --- 4654,4735 ---- } ! CollectionEntry entry = GetCollectionEntryOrNull( collection ); ! ICollectionPersister roleBeforeFlush = ( entry == null ) ? null : entry.loadedPersister; ! FilterTranslator filterTranslator; if( roleBeforeFlush == null ) ! { ! // if it was previously unreferenced, we need ! // to flush in order to get its state into the ! // database to query Flush(); ! entry = GetCollectionEntryOrNull( collection ); ! ICollectionPersister roleAfterFlush = ( entry == null ) ? null : entry.loadedPersister; ! ! if( roleAfterFlush == null ) { throw new QueryException( "the collection was unreferenced" ); } ! filterTranslator = factory.GetFilter( filter, roleAfterFlush.Role, scalar ); } else { ! // otherwise, we only need to flush if there are ! // in-memory changes to the queried tables ! filterTranslator = factory.GetFilter( filter, roleBeforeFlush.Role, scalar ); ! if( AutoFlushIfRequired( filterTranslator.QuerySpaces ) ) { ! // might need to run a different filter entirely after the flush ! // because the collection role may have changed ! entry = GetCollectionEntryOrNull( collection ); ! ICollectionPersister roleAfterFlush = ( entry == null ) ? null : entry.loadedPersister; ! if( roleBeforeFlush != roleAfterFlush ) { ! if( roleAfterFlush == null ) throw new QueryException( "The collection was dereferenced" ); } ! filterTranslator = factory.GetFilter( filter, roleAfterFlush.Role, scalar ); } } ! parameters.PositionalParameterValues[ 0 ] = entry.loadedKey; ! parameters.PositionalParameterTypes[ 0 ] = entry.loadedPersister.KeyType; ! return filterTranslator; ! ! } ! ! /// <summary> ! /// Get the collection entry for a collection passed to filter, ! /// which might be a collection wrapper, an array, or an unwrapped ! /// collection. Return <c>null</c> if there is no entry. ! /// </summary> ! /// <param name="collection"></param> ! /// <returns></returns> ! private CollectionEntry GetCollectionEntryOrNull( object collection ) ! { ! PersistentCollection coll; ! if ( collection is PersistentCollection ) ! { ! coll = (PersistentCollection) collection; ! } ! else ! { ! coll = GetArrayHolder( collection ); ! if ( coll == null ) ! { ! // it might be an unwrapped collection reference! ! // try to find a wrapper (slowish) ! foreach( PersistentCollection pc in collectionEntries.Keys ) ! { ! if( pc.IsWrapper( collection ) ) ! { ! coll = pc; ! break; ! } ! } ! } ! } + return (coll == null) ? null : GetCollectionEntry( coll ); } |