Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Persister In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1056/NHibernate/Persister Modified Files: AbstractEntityPersister.cs EntityPersister.cs IClassPersister.cs ILoadable.cs IQueryable.cs NormalizedEntityPersister.cs Log Message: Synch with h2.0.3 Added support for "formula" mapping to a property. Added support for dynamic insert via the "insert" attribute Index: NormalizedEntityPersister.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Persister/NormalizedEntityPersister.cs,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** NormalizedEntityPersister.cs 28 Apr 2004 03:46:51 -0000 1.17 --- NormalizedEntityPersister.cs 23 Jun 2004 21:08:20 -0000 1.18 *************** *** 15,30 **** ! namespace NHibernate.Persister { /// <summary> /// A <c>IClassPersister</c> implementing the normalized "table-per-subclass" mapping strategy /// </summary> ! public class NormalizedEntityPersister : AbstractEntityPersister { private readonly ISessionFactoryImplementor factory; [...2061 lines suppressed...] } ! ! public override string WhereJoinFragment(string alias, bool innerJoin, bool includeSubclasses) ! { return Outerjoin(alias, innerJoin, includeSubclasses).ToWhereFragmentString; } ! public override string QueryWhereFragment(string alias, bool innerJoin, bool includeSubclasses) ! { return WhereJoinFragment(alias, innerJoin, includeSubclasses); } ! ! public override string[] IdentifierColumnNames ! { ! get { return tableKeyColumns[0]; } ! } ! } } Index: IClassPersister.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Persister/IClassPersister.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** IClassPersister.cs 24 Mar 2004 19:54:01 -0000 1.5 --- IClassPersister.cs 23 Jun 2004 21:08:20 -0000 1.6 *************** *** 7,12 **** using NHibernate.Metadata; ! namespace NHibernate.Persister { ! /// <summary> /// Concrete <c>IClassPersister</c>s implement mapping and persistence logic for a particular class. --- 7,12 ---- using NHibernate.Metadata; ! namespace NHibernate.Persister ! { /// <summary> /// Concrete <c>IClassPersister</c>s implement mapping and persistence logic for a particular class. *************** *** 16,20 **** /// (PersistentClass, SessionFactoryImplementor) /// </remarks> ! public interface IClassPersister { /// <summary> --- 16,21 ---- /// (PersistentClass, SessionFactoryImplementor) /// </remarks> ! public interface IClassPersister ! { /// <summary> *************** *** 50,58 **** /// <summary> - /// Does it have a composite key? - /// </summary> - bool HasCompositeKey { get; } - - /// <summary> /// Does the class implement the <c>ILifecycle</c> inteface? /// </summary> --- 51,54 ---- *************** *** 70,76 **** /// <summary> ! /// Get an array of interfaces that the proxy object implements /// </summary> ! System.Type[] ProxyInterfaces { get; } //TODO: .NET proxy only can implement one??? /// <summary> --- 66,73 ---- /// <summary> ! /// Get an array of interfaces that the proxy object implements - must include ! /// proxy interfaces for all subclasses /// </summary> ! System.Type[] ProxyInterfaces { get; } /// <summary> Index: ILoadable.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Persister/ILoadable.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ILoadable.cs 18 Mar 2004 18:38:53 -0000 1.5 --- ILoadable.cs 23 Jun 2004 21:08:20 -0000 1.6 *************** *** 3,23 **** using NHibernate.Type; ! namespace NHibernate.Persister { ! /// <summary> ! /// Implemented by <c>ClassPersister</c> that uses <c>Loader</c>. THere are several optional /// operations used only by loaders that inherit <c>OuterJoinLoader</c> /// </summary> ! public interface ILoadable : IClassPersister { ! /// <summary> ! /// The names of columns used to persist the identifier /// </summary> ! string[] IdentifierColumnNames { get; } /// <summary> ! /// Does the persistent class have subclasses? /// </summary> ! bool HasSubclasses { get; } /// <summary> --- 3,28 ---- using NHibernate.Type; ! namespace NHibernate.Persister ! { /// <summary> ! /// Implemented by <c>ClassPersister</c> that uses <c>Loader</c>. There are several optional /// operations used only by loaders that inherit <c>OuterJoinLoader</c> /// </summary> ! public interface ILoadable : IClassPersister ! { /// <summary> ! /// Does the persistent class have subclasses? /// </summary> ! bool HasSubclasses { get; } /// <summary> ! /// The fully-qualified tablename used to persist this class /// </summary> ! string TableName { get; } ! ! /// <summary> ! /// The names of columns used to persist the identifier ! /// </summary> ! string[] IdentifierColumnNames { get; } /// <summary> *************** *** 45,53 **** string[] GetPropertyColumnNames(int i); ! /// <summary> ! /// The fully-qualified tablename used to persist this class ! /// </summary> ! string TableName { get; } ! //USED BY OuterJoinLoader + subclasses --- 50,54 ---- string[] GetPropertyColumnNames(int i); ! //USED BY OuterJoinLoader + subclasses Index: IQueryable.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Persister/IQueryable.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** IQueryable.cs 23 Apr 2003 11:50:18 -0000 1.6 --- IQueryable.cs 23 Jun 2004 21:08:20 -0000 1.7 *************** *** 2,12 **** using NHibernate.Type; ! namespace NHibernate.Persister { /// <summary> /// Extends the generic <c>IClassPersister</c> contract to add operations required /// by the query language /// </summary> ! public interface IQueryable : ILoadable { ! /// <summary> /// Is this class mapped as a subclass of another class? --- 2,13 ---- using NHibernate.Type; ! namespace NHibernate.Persister ! { /// <summary> /// Extends the generic <c>IClassPersister</c> contract to add operations required /// by the query language /// </summary> ! public interface IQueryable : ILoadable ! { /// <summary> /// Is this class mapped as a subclass of another class? Index: EntityPersister.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Persister/EntityPersister.cs,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** EntityPersister.cs 28 Apr 2004 03:46:51 -0000 1.17 --- EntityPersister.cs 23 Jun 2004 21:08:19 -0000 1.18 *************** *** 14,24 **** using NHibernate.Id; ! ! namespace NHibernate.Persister { /// <summary> /// Default implementation of the <c>ClassPersister</c> interface. Implements the ! /// "table-per-class hierarchy" mapping strategy for an entity class /// </summary> ! public class EntityPersister : AbstractEntityPersister, IQueryable { private readonly ISessionFactoryImplementor factory; [...1555 lines suppressed...] ! public override string WhereJoinFragment(string alias, bool innerJoin, bool includeSublasses) { return String.Empty; } --- 1157,1171 ---- // this works now because there are no parameters in the select string return frag.AddColumns(name, subclassColumnClosure, subclassColumnAliasClosure) + .AddFormulas(name, subclassFormulaTemplateClosure, subclassFormulaAliasClosure) .ToSqlStringFragment().ToString(); } ! public override string FromJoinFragment(string alias, bool innerJoin, bool includeSubclasses) ! { return String.Empty; } ! public override string WhereJoinFragment(string alias, bool innerJoin, bool includeSublasses) ! { return String.Empty; } Index: AbstractEntityPersister.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Persister/AbstractEntityPersister.cs,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** AbstractEntityPersister.cs 15 Apr 2004 11:36:36 -0000 1.17 --- AbstractEntityPersister.cs 23 Jun 2004 21:08:19 -0000 1.18 *************** *** 2,5 **** --- 2,6 ---- using System.Collections; using System.Reflection; + using NHibernate.Cache; using NHibernate.Cfg; *************** *** 16,20 **** using NHibernate.Loader; [...1055 lines suppressed...] } + // IDictionary was a Set in h2.0.3 + protected void CheckColumnDuplication(IDictionary distinctColumns, ICollection columns) + { + foreach(Column col in columns) + { + if( distinctColumns.Contains(col.Name) ) + { + throw new MappingException( + "Repated column in mapping for class " + + className + + " should be mapped with insert=\"false\" update=\"false\": " + + col.Name); + } + } + } + public abstract string QueryWhereFragment(string alias, bool innerJoin, bool includeSublcasses); public abstract string DiscriminatorSQLString { get; } |