protected virtual bool IsTargetProperty(IPropertyType pt, string timestampPropertyName, string versionNoPropertyName, object bean) { IIdentifierGenerator identifierGenerator = BeanMetaData.IdentifierGenerator; if (pt.IsPrimaryKey) { return(identifierGenerator.IsSelfGenerate); } string propertyName = pt.PropertyName; if (propertyName.Equals(timestampPropertyName, StringComparison.CurrentCultureIgnoreCase) || propertyName.Equals(versionNoPropertyName, StringComparison.CurrentCultureIgnoreCase)) { return(true); } object value = pt.PropertyInfo.GetValue(bean, null); // for normal type include Nullable<T> if (value == null) { return(false); } // for Sytem.Data.SqlTypes.INullable if (value is INullable && ((INullable)value).IsNull) { return(false); } return(true); }
/// <summary> /// Generates an IdentifierProperty representation of the for a given entity mapping. /// </summary> /// <param name="mappedEntity">The mapping definition of the entity.</param> /// <param name="generator">The identifier value generator to use for this identifier.</param> /// <returns>The appropriate IdentifierProperty definition.</returns> public static IdentifierProperty BuildIdentifierProperty(PersistentClass mappedEntity, IIdentifierGenerator generator) { string mappedUnsavedValue = mappedEntity.Identifier.NullValue; IType type = mappedEntity.Identifier.Type; Mapping.Property property = mappedEntity.IdentifierProperty; Cascades.IdentifierValue unsavedValue = UnsavedValueFactory.GetUnsavedIdentifierValue( mappedUnsavedValue, GetGetter(property), type, GetConstructor(mappedEntity) ); if (property == null) { // this is a virtual id property... return new IdentifierProperty( type, mappedEntity.HasEmbeddedIdentifier, unsavedValue, generator ); } else { return new IdentifierProperty( property.Name, null, // TODO H3: property.NodeName, type, mappedEntity.HasEmbeddedIdentifier, unsavedValue, generator ); } }
public InvolvedTypeReportGenerator( InvolvedType[] involvedTypes, IIdentifierGenerator <Assembly> assemblyIdentifierGenerator, IIdentifierGenerator <Type> involvedTypeIdentifierGenerator, IIdentifierGenerator <MemberInfo> memberIdentifierGenerator, IIdentifierGenerator <Type> interfaceIdentifierGenerator, IIdentifierGenerator <Type> attributeIdentifierGenerator, IRemotionReflector remotionReflector, IOutputFormatter outputFormatter) { ArgumentUtility.CheckNotNull("involvedTypes", involvedTypes); ArgumentUtility.CheckNotNull("assemblyIdentifierGenerator", assemblyIdentifierGenerator); ArgumentUtility.CheckNotNull("involvedTypeIdentifierGenerator", involvedTypeIdentifierGenerator); ArgumentUtility.CheckNotNull("memberIdentifierGenerator", memberIdentifierGenerator); ArgumentUtility.CheckNotNull("interfaceIdentifierGenerator", interfaceIdentifierGenerator); ArgumentUtility.CheckNotNull("attributeIdentifierGenerator", attributeIdentifierGenerator); ArgumentUtility.CheckNotNull("remotionReflector", remotionReflector); ArgumentUtility.CheckNotNull("outputFormatter", outputFormatter); _involvedTypes = involvedTypes; _assemblyIdentifierGenerator = assemblyIdentifierGenerator; _involvedTypeIdentifierGenerator = involvedTypeIdentifierGenerator; _memberIdentifierGenerator = memberIdentifierGenerator; _interfaceIdentifierGenerator = interfaceIdentifierGenerator; _attributeIdentifierGenerator = attributeIdentifierGenerator; _remotionReflector = remotionReflector; _outputFormatter = outputFormatter; }
public InvolvedTypeReportGenerator( InvolvedType[] involvedTypes, IIdentifierGenerator<Assembly> assemblyIdentifierGenerator, IIdentifierGenerator<Type> involvedTypeIdentifierGenerator, IIdentifierGenerator<MemberInfo> memberIdentifierGenerator, IIdentifierGenerator<Type> interfaceIdentifierGenerator, IIdentifierGenerator<Type> attributeIdentifierGenerator, IRemotionReflector remotionReflector, IOutputFormatter outputFormatter) { ArgumentUtility.CheckNotNull ("involvedTypes", involvedTypes); ArgumentUtility.CheckNotNull ("assemblyIdentifierGenerator", assemblyIdentifierGenerator); ArgumentUtility.CheckNotNull ("involvedTypeIdentifierGenerator", involvedTypeIdentifierGenerator); ArgumentUtility.CheckNotNull ("memberIdentifierGenerator", memberIdentifierGenerator); ArgumentUtility.CheckNotNull ("interfaceIdentifierGenerator", interfaceIdentifierGenerator); ArgumentUtility.CheckNotNull ("attributeIdentifierGenerator", attributeIdentifierGenerator); ArgumentUtility.CheckNotNull ("remotionReflector", remotionReflector); ArgumentUtility.CheckNotNull ("outputFormatter", outputFormatter); _involvedTypes = involvedTypes; _assemblyIdentifierGenerator = assemblyIdentifierGenerator; _involvedTypeIdentifierGenerator = involvedTypeIdentifierGenerator; _memberIdentifierGenerator = memberIdentifierGenerator; _interfaceIdentifierGenerator = interfaceIdentifierGenerator; _attributeIdentifierGenerator = attributeIdentifierGenerator; _remotionReflector = remotionReflector; _outputFormatter = outputFormatter; }
public TargetCallDependenciesReportGenerator(ReflectedObject mixinDefinition, IIdentifierGenerator<Assembly> assemblyIdentifierGenerator, IRemotionReflector remotionReflector, IOutputFormatter outputFormatter) { _mixinDefinition = mixinDefinition; _assemblyIdentifierGenerator = assemblyIdentifierGenerator; _remotionReflector = remotionReflector; _outputFormatter = outputFormatter; }
public MixinReferenceReportGenerator( InvolvedType involvedType, IIdentifierGenerator <Assembly> assemblyIdentifierGenerator, IIdentifierGenerator <Type> involvedTypeIdentifierGenerator, IIdentifierGenerator <Type> interfaceIdentifierGenerator, IIdentifierGenerator <Type> attributeIdentifierGenerator, IRemotionReflector remotionReflector, IOutputFormatter outputFormatter ) { ArgumentUtility.CheckNotNull("involvedType", involvedType); ArgumentUtility.CheckNotNull("assemblyIdentifierGenerator", assemblyIdentifierGenerator); ArgumentUtility.CheckNotNull("involvedTypeIdentifierGenerator", involvedTypeIdentifierGenerator); ArgumentUtility.CheckNotNull("interfaceIdentifierGenerator", interfaceIdentifierGenerator); ArgumentUtility.CheckNotNull("attributeIdentifierGenerator", attributeIdentifierGenerator); ArgumentUtility.CheckNotNull("remotionReflector", remotionReflector); ArgumentUtility.CheckNotNull("outputFormatter", outputFormatter); _involvedType = involvedType; _assemblyIdentifierGenerator = assemblyIdentifierGenerator; _involvedTypeIdentifierGenerator = involvedTypeIdentifierGenerator; _interfaceIdentifierGenerator = interfaceIdentifierGenerator; _attributeIdentifierGenerator = attributeIdentifierGenerator; _remotionReflector = remotionReflector; _outputFormatter = outputFormatter; }
public MixinReferenceReportGenerator( InvolvedType involvedType, IIdentifierGenerator<Assembly> assemblyIdentifierGenerator, IIdentifierGenerator<Type> involvedTypeIdentifierGenerator, IIdentifierGenerator<Type> interfaceIdentifierGenerator, IIdentifierGenerator<Type> attributeIdentifierGenerator, IRemotionReflector remotionReflector, IOutputFormatter outputFormatter ) { ArgumentUtility.CheckNotNull ("involvedType", involvedType); ArgumentUtility.CheckNotNull ("assemblyIdentifierGenerator", assemblyIdentifierGenerator); ArgumentUtility.CheckNotNull ("involvedTypeIdentifierGenerator", involvedTypeIdentifierGenerator); ArgumentUtility.CheckNotNull ("interfaceIdentifierGenerator", interfaceIdentifierGenerator); ArgumentUtility.CheckNotNull ("attributeIdentifierGenerator", attributeIdentifierGenerator); ArgumentUtility.CheckNotNull ("remotionReflector", remotionReflector); ArgumentUtility.CheckNotNull ("outputFormatter", outputFormatter); _involvedType = involvedType; _assemblyIdentifierGenerator = assemblyIdentifierGenerator; _involvedTypeIdentifierGenerator = involvedTypeIdentifierGenerator; _interfaceIdentifierGenerator = interfaceIdentifierGenerator; _attributeIdentifierGenerator = attributeIdentifierGenerator; _remotionReflector = remotionReflector; _outputFormatter = outputFormatter; }
public void SetUp() { _identifierGenerator = new IdentifierGenerator <Type> (); _remotionReflector = MockRepository.GenerateStub <IRemotionReflector> (); _remotionReflector.Stub(r => r.IsInfrastructureType(typeof(UsesAttribute))).Return(true); _remotionReflector.Stub(r => r.IsInfrastructureType(typeof(ExtendsAttribute))).Return(true); }
public TargetCallDependenciesReportGenerator(ReflectedObject mixinDefinition, IIdentifierGenerator <Assembly> assemblyIdentifierGenerator, IRemotionReflector remotionReflector, IOutputFormatter outputFormatter) { _mixinDefinition = mixinDefinition; _assemblyIdentifierGenerator = assemblyIdentifierGenerator; _remotionReflector = remotionReflector; _outputFormatter = outputFormatter; }
public RoomManager() { Rooms = new Dictionary <string, IRoom>(); PlayerRooms = new Dictionary <IPlayer, ICollection <IRoom> >(); openLobbies = new Dictionary <int, int>(); IdGenerator = new HexIdGenerator(); }
public ReadonlyIdentifierGenerator(IIdentifierGenerator <T> identifierGenerator, string defaultValue) { ArgumentUtility.CheckNotNull("identifierGenerator", identifierGenerator); ArgumentUtility.CheckNotNull("defaultValue", defaultValue); _identifierGenerator = identifierGenerator; _defaultValue = defaultValue; }
public TargetReferenceReportGenerator(InvolvedType mixinType, IIdentifierGenerator <Type> involvedTypeIdentifierGenerator) { ArgumentUtility.CheckNotNull("mixinType", mixinType); ArgumentUtility.CheckNotNull("involvedTypeIdentifierGenerator", involvedTypeIdentifierGenerator); _mixinType = mixinType; _involvedTypeIdentifierGenerator = involvedTypeIdentifierGenerator; }
public TargetReferenceReportGenerator(InvolvedType mixinType, IIdentifierGenerator<Type> involvedTypeIdentifierGenerator) { ArgumentUtility.CheckNotNull ("mixinType", mixinType); ArgumentUtility.CheckNotNull ("involvedTypeIdentifierGenerator", involvedTypeIdentifierGenerator); _mixinType = mixinType; _involvedTypeIdentifierGenerator = involvedTypeIdentifierGenerator; }
public void InsertWithGeneratedTimestampVersion() { // Make sure the env supports bulk inserts with generated ids... IEntityPersister persister = Sfi.GetEntityPersister(typeof(TimestampVersioned).FullName); IIdentifierGenerator generator = persister.IdentifierGenerator; if (!HqlSqlWalker.SupportsIdGenWithBulkInsertion(generator)) { return; } ISession s = OpenSession(); ITransaction t = s.BeginTransaction(); var entity = new TimestampVersioned { Name = "int-vers" }; s.Save(entity); s.CreateQuery("select id, name, version from TimestampVersioned").List(); t.Commit(); s.Close(); long initialId = entity.Id; //Date initialVersion = entity.getVersion(); s = OpenSession(); t = s.BeginTransaction(); int count = s.CreateQuery( "insert into TimestampVersioned ( name, Data ) select name, Data from TimestampVersioned where id = :id") .SetInt64("id", entity.Id) .ExecuteUpdate(); t.Commit(); s.Close(); Assert.That(count, Is.EqualTo(1), "unexpected insertion count"); s = OpenSession(); t = s.BeginTransaction(); var created = (TimestampVersioned) s.CreateQuery("from TimestampVersioned where id <> :initialId").SetInt64("initialId", initialId).UniqueResult(); t.Commit(); s.Close(); Assert.That(created.Version, Is.GreaterThan(DateTime.Today)); s = OpenSession(); t = s.BeginTransaction(); s.CreateQuery("delete TimestampVersioned").ExecuteUpdate(); t.Commit(); s.Close(); }
protected override void PreUpdateBean(Object bean) { IIdentifierGenerator generator = BeanMetaData.IdentifierGenerator; if (generator.IsSelfGenerate) { generator.SetIdentifier(bean, DataSource); } }
/// <summary> /// /// </summary> /// <param name="dialect"></param> /// <returns></returns> public IIdentifierGenerator CreateIdentifierGenerator(Dialect.Dialect dialect) { if (uniqueIdentifierGenerator == null) { uniqueIdentifierGenerator = IdentifierGeneratorFactory.Create(identifierGeneratorStrategy, type, identifierGeneratorProperties, dialect); } return(uniqueIdentifierGenerator); }
/// <summary> /// Construct a virtual IdentifierProperty. /// </summary> /// <param name="type">The Hibernate Type for the identifier property.</param> /// <param name="embedded">Is this an embedded identifier.</param> /// <param name="unsavedValue">The value which, if found as the value on the identifier /// property, represents new (i.e., un-saved) instances of the owning entity.</param> /// <param name="identifierGenerator">The generator to use for id value generation.</param> /// <param name="hasIdentifierMapper"></param> public IdentifierProperty(IType type, bool embedded, bool hasIdentifierMapper, IdentifierValue unsavedValue, IIdentifierGenerator identifierGenerator) : base(null, null, type) { isVirtual = true; this.embedded = embedded; this.hasIdentifierMapper = hasIdentifierMapper; this.unsavedValue = unsavedValue; this.identifierGenerator = identifierGenerator; identifierAssignedByInsert = identifierGenerator is IPostInsertIdentifierGenerator; }
public InterfaceIntroductionReportGenerator( ReflectedObject interfaceIntroductionDefinitions, IIdentifierGenerator<Type> interfaceIdentifierGenerator) { ArgumentUtility.CheckNotNull ("interfaceIntroductionDefinitions", interfaceIntroductionDefinitions); ArgumentUtility.CheckNotNull ("interfaceIdentifierGenerator", interfaceIdentifierGenerator); _interfaceIntroductionDefinitions = interfaceIntroductionDefinitions; _interfaceIdentifierGenerator = interfaceIdentifierGenerator; }
public InterfaceIntroductionReportGenerator( ReflectedObject interfaceIntroductionDefinitions, IIdentifierGenerator <Type> interfaceIdentifierGenerator) { ArgumentUtility.CheckNotNull("interfaceIntroductionDefinitions", interfaceIntroductionDefinitions); ArgumentUtility.CheckNotNull("interfaceIdentifierGenerator", interfaceIdentifierGenerator); _interfaceIntroductionDefinitions = interfaceIntroductionDefinitions; _interfaceIdentifierGenerator = interfaceIdentifierGenerator; }
/// <summary> /// Construct a virtual IdentifierProperty. /// </summary> /// <param name="type">The Hibernate Type for the identifier property.</param> /// <param name="embedded">Is this an embedded identifier.</param> /// <param name="unsavedValue">The value which, if found as the value on the identifier /// property, represents new (i.e., un-saved) instances of the owning entity.</param> /// <param name="identifierGenerator">The generator to use for id value generation.</param> /// <param name="hasIdentifierMapper"></param> public IdentifierProperty(IType type, bool embedded, bool hasIdentifierMapper, IdentifierValue unsavedValue, IIdentifierGenerator identifierGenerator) : base(null, type) { isVirtual = true; this.embedded = embedded; this.hasIdentifierMapper = hasIdentifierMapper; this.unsavedValue = unsavedValue; this.identifierGenerator = identifierGenerator; identifierAssignedByInsert = identifierGenerator is IPostInsertIdentifierGenerator; }
public async Task InsertWithGeneratedVersionAndIdAsync() { // Make sure the env supports bulk inserts with generated ids... IEntityPersister persister = Sfi.GetEntityPersister(typeof(IntegerVersioned).FullName); IIdentifierGenerator generator = persister.IdentifierGenerator; if (!HqlSqlWalker.SupportsIdGenWithBulkInsertion(generator)) { return; } ISession s = OpenSession(); ITransaction t = s.BeginTransaction(); var entity = new IntegerVersioned { Name = "int-vers" }; await(s.SaveAsync(entity)); await(s.CreateQuery("select id, name, version from IntegerVersioned").ListAsync()); await(t.CommitAsync()); s.Close(); long initialId = entity.Id; int initialVersion = entity.Version; s = OpenSession(); t = s.BeginTransaction(); int count = await(s.CreateQuery("insert into IntegerVersioned ( name, Data ) select name, Data from IntegerVersioned where id = :id") .SetInt64("id", entity.Id) .ExecuteUpdateAsync()); await(t.CommitAsync()); s.Close(); Assert.That(count, Is.EqualTo(1), "unexpected insertion count"); s = OpenSession(); t = s.BeginTransaction(); var created = (IntegerVersioned) await(s.CreateQuery("from IntegerVersioned where id <> :initialId").SetInt64("initialId", initialId).UniqueResultAsync()); await(t.CommitAsync()); s.Close(); Assert.That(created.Version, Is.EqualTo(initialVersion), "version was not seeded"); s = OpenSession(); t = s.BeginTransaction(); await(s.CreateQuery("delete IntegerVersioned").ExecuteUpdateAsync()); await(t.CommitAsync()); s.Close(); }
protected override void PostUpdateBean(Object bean, int ret) { IIdentifierGenerator generator = BeanMetaData.IdentifierGenerator; if (!generator.IsSelfGenerate) { generator.SetIdentifier(bean, DataSource); } UpdateVersionNoIfNeed(bean); UpdateTimestampIfNeed(bean); }
public InterfaceReferenceReportGenerator( InvolvedType involvedType, IIdentifierGenerator <Type> interfaceIdentifierGenerator, IRemotionReflector remotionReflector) { ArgumentUtility.CheckNotNull("involvedType", involvedType); ArgumentUtility.CheckNotNull("interfaceIdentifierGenerator", interfaceIdentifierGenerator); ArgumentUtility.CheckNotNull("remotionReflector", remotionReflector); _involvedType = involvedType; _interfaceIdentifierGenerator = interfaceIdentifierGenerator; _remotionReflector = remotionReflector; }
public void SetUp() { _mixinConfiguration = MixinConfiguration.BuildNew().ForClass <AdditionalDependenciesTest.TargetClass>() .AddMixin <AdditionalDependenciesTest.Mixin1>() .AddMixin <AdditionalDependenciesTest.Mixin2>() .AddMixin <AdditionalDependenciesTest.Mixin3>() .WithDependencies <AdditionalDependenciesTest.Mixin1, AdditionalDependenciesTest.Mixin2>() .BuildConfiguration(); _outputFormatter = new OutputFormatter(); _identifierGenerator = new IdentifierGenerator <Type>(); }
public AttributeReferenceReportGenerator( Type type, IIdentifierGenerator<Type> attributeIdentifierGenerator, IRemotionReflector remotionReflector) { ArgumentUtility.CheckNotNull ("type", type); ArgumentUtility.CheckNotNull ("attributeIdentifierGenerator", attributeIdentifierGenerator); ArgumentUtility.CheckNotNull ("remotionReflector", remotionReflector); _type = type; _attributeIdentifierGenerator = attributeIdentifierGenerator; _remotionReflector = remotionReflector; }
public AttributeReferenceReportGenerator( Type type, IIdentifierGenerator <Type> attributeIdentifierGenerator, IRemotionReflector remotionReflector) { ArgumentUtility.CheckNotNull("type", type); ArgumentUtility.CheckNotNull("attributeIdentifierGenerator", attributeIdentifierGenerator); ArgumentUtility.CheckNotNull("remotionReflector", remotionReflector); _type = type; _attributeIdentifierGenerator = attributeIdentifierGenerator; _remotionReflector = remotionReflector; }
public InterfaceReferenceReportGenerator( InvolvedType involvedType, IIdentifierGenerator<Type> interfaceIdentifierGenerator, IRemotionReflector remotionReflector) { ArgumentUtility.CheckNotNull ("involvedType", involvedType); ArgumentUtility.CheckNotNull ("interfaceIdentifierGenerator", interfaceIdentifierGenerator); ArgumentUtility.CheckNotNull ("remotionReflector", remotionReflector); _involvedType = involvedType; _interfaceIdentifierGenerator = interfaceIdentifierGenerator; _remotionReflector = remotionReflector; }
public Db4OEmbeddedRepository(IObjectContainer objectContainer, IIdentifierGenerator <TIdentity> identifierGenerator, Expression <Func <TEntity, TIdentity> > keySelector) : base(keySelector) { if (objectContainer == null) { throw new ArgumentNullException("objectContainer"); } _objectContainer = objectContainer; _identifierGenerator = identifierGenerator; }
private InvolvedTypeReportGenerator CreateInvolvedTypeReportGenerator(params InvolvedType[] involvedTypes) { _readOnlyInvolvedTypeIdentifierGenerator = new IdentifierPopulator <Type> (involvedTypes.Select(i => i.Type)).GetReadonlyIdentifierGenerator("none"); return(new InvolvedTypeReportGenerator(involvedTypes, _assemblyIdentifierGenerator, _readOnlyInvolvedTypeIdentifierGenerator, _memberIdentifierGenerator, _interfaceIdentifierGenerator, _attributeIdentifierGenerator, _remotionReflector, _outputFormatter)); }
public void SetUp() { _remotionReflector = Helpers.RemotionReflectorFactory.GetRemotionReflection(); _outputFormatter = new OutputFormatter(); _involvedTypeIdentifierGenerator = new IdentifierGenerator <Type> (); _interfaceIdentifierGenerator = new IdentifierGenerator <Type> (); _attributeIdentifierGenerator = new IdentifierGenerator <Type> (); _assemblyIdentifierGenerator = new IdentifierGenerator <Assembly> (); _memberIdentifierGenerator = new IdentifierGenerator <MemberInfo> (); _readOnlyInvolvedTypeIdentifierGenerator = new ReadonlyIdentifierGenerator <Type> (_involvedTypeIdentifierGenerator, "none"); }
public AdditionalDependencyReportGenerator( ReflectedObject explicitDependencies, IIdentifierGenerator<Type> involvedTypeIdentifierGenerator, IOutputFormatter outputFormatter) { ArgumentUtility.CheckNotNull ("explicitDependencies", explicitDependencies); ArgumentUtility.CheckNotNull ("involvedTypeIdentifierGenerator", involvedTypeIdentifierGenerator); ArgumentUtility.CheckNotNull ("outputFormatter", outputFormatter); _explicitDependencies = explicitDependencies; _involvedTypeIdentifierGenerator = involvedTypeIdentifierGenerator; _outputFormatter = outputFormatter; }
public AssemblyReportGenerator( InvolvedType[] involvedTypes, IIdentifierGenerator<Assembly> assemblyIdentifierGenerator, IIdentifierGenerator<Type> involvedTypeIdentifierGenerator) { ArgumentUtility.CheckNotNull ("involvedTypes", involvedTypes); ArgumentUtility.CheckNotNull ("assemblyIdentifierGenerator", assemblyIdentifierGenerator); ArgumentUtility.CheckNotNull ("involvedTypeIdentifierGenerator", involvedTypeIdentifierGenerator); _involvedTypes = involvedTypes; _assemblyIdentifierGenerator = assemblyIdentifierGenerator; _involvedTypeIdentifierGenerator = involvedTypeIdentifierGenerator; }
public AdditionalDependencyReportGenerator( ReflectedObject explicitDependencies, IIdentifierGenerator <Type> involvedTypeIdentifierGenerator, IOutputFormatter outputFormatter) { ArgumentUtility.CheckNotNull("explicitDependencies", explicitDependencies); ArgumentUtility.CheckNotNull("involvedTypeIdentifierGenerator", involvedTypeIdentifierGenerator); ArgumentUtility.CheckNotNull("outputFormatter", outputFormatter); _explicitDependencies = explicitDependencies; _involvedTypeIdentifierGenerator = involvedTypeIdentifierGenerator; _outputFormatter = outputFormatter; }
public AttributeIntroductionReportGenerator( ReflectedObject attributeIntroductionDefinitions, IIdentifierGenerator <Type> attributeIdentifierGenerator, IRemotionReflector remotionReflector) { ArgumentUtility.CheckNotNull("attributeIntroductionDefinitions", attributeIntroductionDefinitions); ArgumentUtility.CheckNotNull("attributeIdentifierGenerator", attributeIdentifierGenerator); ArgumentUtility.CheckNotNull("remotionReflector", remotionReflector); _attributeIntroductionDefinitions = attributeIntroductionDefinitions; _attributeIdentifierGenerator = attributeIdentifierGenerator; _remotionReflector = remotionReflector; }
public AssemblyReportGenerator( InvolvedType[] involvedTypes, IIdentifierGenerator <Assembly> assemblyIdentifierGenerator, IIdentifierGenerator <Type> involvedTypeIdentifierGenerator) { ArgumentUtility.CheckNotNull("involvedTypes", involvedTypes); ArgumentUtility.CheckNotNull("assemblyIdentifierGenerator", assemblyIdentifierGenerator); ArgumentUtility.CheckNotNull("involvedTypeIdentifierGenerator", involvedTypeIdentifierGenerator); _involvedTypes = involvedTypes; _assemblyIdentifierGenerator = assemblyIdentifierGenerator; _involvedTypeIdentifierGenerator = involvedTypeIdentifierGenerator; }
public AttributeIntroductionReportGenerator( ReflectedObject attributeIntroductionDefinitions, IIdentifierGenerator<Type> attributeIdentifierGenerator, IRemotionReflector remotionReflector) { ArgumentUtility.CheckNotNull ("attributeIntroductionDefinitions", attributeIntroductionDefinitions); ArgumentUtility.CheckNotNull ("attributeIdentifierGenerator", attributeIdentifierGenerator); ArgumentUtility.CheckNotNull ("remotionReflector", remotionReflector); _attributeIntroductionDefinitions = attributeIntroductionDefinitions; _attributeIdentifierGenerator = attributeIdentifierGenerator; _remotionReflector = remotionReflector; }
/// <summary> /// Construct a virtual IdentifierProperty. /// </summary> /// <param name="type">The Hibernate Type for the identifier property.</param> /// <param name="embedded">Is this an embedded identifier.</param> /// <param name="unsavedValue">The value which, if found as the value on the identifier /// property, represents new (i.e., un-saved) instances of the owning entity.</param> /// <param name="identifierGenerator">The generator to use for id value generation.</param> public IdentifierProperty( IType type, bool embedded, Cascades.IdentifierValue unsavedValue, IIdentifierGenerator identifierGenerator) : base(null, null, type) { this.isVirtual = true; this.embedded = embedded; this.unsavedValue = unsavedValue; this.identifierGenerator = identifierGenerator; this.identifierAssignedByInsert = identifierGenerator is IdentityGenerator; // TODO H3: identifierGenerator is PostInsertIdentifierGenerator; }
/// <summary> /// Construct a non-virtual identifier property. /// </summary> /// <param name="name">The name of the property representing the identifier within /// its owning entity.</param> /// <param name="type">The Hibernate Type for the identifier property.</param> /// <param name="embedded">Is this an embedded identifier.</param> /// <param name="unsavedValue">The value which, if found as the value on the identifier /// property, represents new (i.e., un-saved) instances of the owning entity.</param> /// <param name="identifierGenerator">The generator to use for id value generation.</param> public IdentifierProperty( String name, IType type, bool embedded, IdentifierValue unsavedValue, IIdentifierGenerator identifierGenerator) : base(name, type) { isVirtual = false; this.embedded = embedded; hasIdentifierMapper = false; this.unsavedValue = unsavedValue; this.identifierGenerator = identifierGenerator; identifierAssignedByInsert = identifierGenerator is IPostInsertIdentifierGenerator; }
/// <summary> /// Construct a non-virtual identifier property. /// </summary> /// <param name="name">The name of the property representing the identifier within /// its owning entity.</param> /// <param name="node">The node name to use for XML-based representation of this /// property.</param> /// <param name="type">The Hibernate Type for the identifier property.</param> /// <param name="embedded">Is this an embedded identifier.</param> /// <param name="unsavedValue">The value which, if found as the value on the identifier /// property, represents new (i.e., un-saved) instances of the owning entity.</param> /// <param name="identifierGenerator">The generator to use for id value generation.</param> public IdentifierProperty( String name, String node, IType type, bool embedded, IdentifierValue unsavedValue, IIdentifierGenerator identifierGenerator) : base(name, node, type) { isVirtual = false; this.embedded = embedded; hasIdentifierMapper = false; this.unsavedValue = unsavedValue; this.identifierGenerator = identifierGenerator; identifierAssignedByInsert = identifierGenerator is IPostInsertIdentifierGenerator; }
public void InsertWithGeneratedId() { // Make sure the env supports bulk inserts with generated ids... IEntityPersister persister = Sfi.GetEntityPersister(typeof(PettingZoo).FullName); IIdentifierGenerator generator = persister.IdentifierGenerator; if (!HqlSqlWalker.SupportsIdGenWithBulkInsertion(generator)) { return; } // create a Zoo var zoo = new Zoo { Name = "zoo" }; ISession s = OpenSession(); ITransaction t = s.BeginTransaction(); s.Save(zoo); t.Commit(); s.Close(); s = OpenSession(); t = s.BeginTransaction(); int count = s.CreateQuery("insert into PettingZoo (name) select name from Zoo").ExecuteUpdate(); t.Commit(); s.Close(); Assert.That(count, Is.EqualTo(1), "unexpected insertion count"); s = OpenSession(); t = s.BeginTransaction(); var pz = (PettingZoo)s.CreateQuery("from PettingZoo").UniqueResult(); t.Commit(); s.Close(); Assert.That(zoo.Name, Is.EqualTo(pz.Name)); Assert.That(zoo.Id != pz.Id); s = OpenSession(); t = s.BeginTransaction(); s.CreateQuery("delete Zoo").ExecuteUpdate(); t.Commit(); s.Close(); }
/// <summary> /// Creates an <see cref="IIdentifierGenerator"/> from the named strategy. /// </summary> /// <param name="strategy"> /// The name of the generator to create. This can be one of the NHibernate abbreviations (ie - <c>native</c>, /// <c>sequence</c>, <c>guid.comb</c>, etc...), a full class name if the Type is in the NHibernate assembly, or /// a full type name if the strategy is in an external assembly. /// </param> /// <param name="type">The <see cref="IType"/> that the retured identifier should be.</param> /// <param name="parms">An <see cref="IDictionary"/> of <c><param></c> values from the mapping.</param> /// <param name="dialect">The <see cref="Dialect.Dialect"/> to help with Configuration.</param> /// <returns> /// An instantiated and configured <see cref="IIdentifierGenerator"/>. /// </returns> /// <exception cref="MappingException"> /// Thrown if there are any exceptions while creating the <see cref="IIdentifierGenerator"/>. /// </exception> public static IIdentifierGenerator Create(string strategy, IType type, IDictionary parms, Dialect.Dialect dialect) { try { System.Type clazz = (System.Type)idgenerators[strategy]; if ("native".Equals(strategy)) { if (dialect.SupportsIdentityColumns) { clazz = typeof(IdentityGenerator); } else if (dialect.SupportsSequences) { clazz = typeof(SequenceGenerator); } else { clazz = typeof(TableHiLoGenerator); } } if (clazz == null) { clazz = ReflectHelper.ClassForName(strategy); } IIdentifierGenerator idgen = ( IIdentifierGenerator )Activator.CreateInstance(clazz); // configure if the generator supports it. IConfigurable configurable = idgen as IConfigurable; if (configurable != null) { configurable.Configure(type, parms, dialect); } return(idgen); } catch (Exception e) { string message = "could not instantiate id generator"; if (strategy != null) { message += " for strategy '" + strategy + "'"; } throw new MappingException(message, e); } }
/// <summary> /// 导入数据 /// </summary> /// <param name="struc">模版结构</param> /// <param name="targetTable">目标表</param> /// <param name="primaryKey">表主键</param> /// <param name="filePath">文件路径</param> /// <param name="blockSize">数据块大小</param> public static void ImportData(ImportTemplateStructure struc, string targetTable, SqlConnection sqlConnection, string filePath, int blockSize) { string primaryKey = String.Empty; // 获取主键 string[] primaryKeys = SysTableStructureRule.GetTablePrimaryKey(targetTable); if (primaryKeys.Length == 1) { primaryKey = primaryKeys[0]; } IIdentifierGenerator idGenerator = struc.DefaultGroup.GetIDGenerator(); IList <DataTable> dts = DataImportService.GetDataTableList(struc, filePath, blockSize); int successAmount = 0; foreach (DataTable tdt in dts) { try { if (!String.IsNullOrEmpty(primaryKey)) { if (!tdt.Columns.Contains(primaryKey)) { tdt.Columns.Add(primaryKey); } foreach (DataRow tdrow in tdt.Rows) { tdrow[primaryKey] = idGenerator.Generate(null, null); } } DataHelper.CopyDataToDatabase(tdt, sqlConnection, targetTable); successAmount += tdt.Rows.Count; } catch (Exception ex) { throw new Exception("导入数据失败,已完成导入“" + successAmount + "”条。" + ex.Message); } } }
public MemberReportGenerator( Type type, InvolvedType involvedTypeOrNull, IIdentifierGenerator<Type> involvedTypeIdentifierGeneratorOrNull, IIdentifierGenerator<MemberInfo> memberIdentifierGeneratorOrNull, IOutputFormatter outputFormatter) { ArgumentUtility.CheckNotNull ("type", type); // may be null // ArgumentUtility.CheckNotNull ("involvedTypeOrNull", involvedTypeOrNull); // ArgumentUtility.CheckNotNull ("involvedTypeIdentifierGeneratorOrNull", involvedTypeIdentifierGeneratorOrNull); // ArgumentUtility.CheckNotNull ("memberIdentifierGeneratorOrNull", memberIdentifierGeneratorOrNull); ArgumentUtility.CheckNotNull ("outputFormatter", outputFormatter); _type = type; _involvedType = involvedTypeOrNull; _involvedTypeIdentifierGenerator = involvedTypeIdentifierGeneratorOrNull; _memberIdentifierGenerator = memberIdentifierGeneratorOrNull; _outputFormatter = outputFormatter; _memberSignatureUtility = new MemberSignatureUtility (outputFormatter); }
public MemberReportGenerator( Type type, InvolvedType involvedTypeOrNull, IIdentifierGenerator <Type> involvedTypeIdentifierGeneratorOrNull, IIdentifierGenerator <MemberInfo> memberIdentifierGeneratorOrNull, IOutputFormatter outputFormatter) { ArgumentUtility.CheckNotNull("type", type); // may be null // ArgumentUtility.CheckNotNull ("involvedTypeOrNull", involvedTypeOrNull); // ArgumentUtility.CheckNotNull ("involvedTypeIdentifierGeneratorOrNull", involvedTypeIdentifierGeneratorOrNull); // ArgumentUtility.CheckNotNull ("memberIdentifierGeneratorOrNull", memberIdentifierGeneratorOrNull); ArgumentUtility.CheckNotNull("outputFormatter", outputFormatter); _type = type; _involvedType = involvedTypeOrNull; _involvedTypeIdentifierGenerator = involvedTypeIdentifierGeneratorOrNull; _memberIdentifierGenerator = memberIdentifierGeneratorOrNull; _outputFormatter = outputFormatter; _memberSignatureUtility = new MemberSignatureUtility(outputFormatter); }
public GameController( IRoomManager roomManager, IVerificationService <PlayerVerificationResponseModel> VerificationService, IIdentifierGenerator identifierGenerator, ILobbyService lobbyService, IChatRoomService chatRoomService) { verificationService = VerificationService; RoomManager = roomManager; IdentifierGenerator = identifierGenerator; LobbyService = lobbyService; ChatRoomService = chatRoomService; GameFactory = new GameFactory(); ReadyTimer = new ReadyTimer(); Thread timerThread = new Thread(ReadyTimer.StartTimer); timerThread.Start(); Players = new HashSet <IPlayer>(); GameTypes = new Dictionary <int, string>(); }
/// <summary> /// Initializes a new instance of the AddMissingNamesFixup class object. /// </summary> /// <param name="identifierGenerator">Identifier generator to use.</param> public AddMissingNamesFixup(IIdentifierGenerator identifierGenerator) { this.identifierGenerator = identifierGenerator; }
public void SetUp() { _identifierGenerator = new IdentifierGenerator<Type> (); _remotionReflector = MockRepository.GenerateStub<IRemotionReflector> (); _remotionReflector.Stub (r => r.IsInfrastructureType (typeof (UsesAttribute))).Return (true); _remotionReflector.Stub (r => r.IsInfrastructureType (typeof (ExtendsAttribute))).Return (true); }
public void SetUp() { _remotionReflector = Helpers.RemotionReflectorFactory.GetRemotionReflection (); _outputFormatter = new OutputFormatter (); _involvedTypeIdentifierGenerator = new IdentifierGenerator<Type> (); _interfaceIdentifierGenerator = new IdentifierGenerator<Type> (); _attributeIdentifierGenerator = new IdentifierGenerator<Type> (); _assemblyIdentifierGenerator = new IdentifierGenerator<Assembly> (); _memberIdentifierGenerator = new IdentifierGenerator<MemberInfo> (); _readOnlyInvolvedTypeIdentifierGenerator = new ReadonlyIdentifierGenerator<Type> (_involvedTypeIdentifierGenerator, "none"); }
private InvolvedTypeReportGenerator CreateInvolvedTypeReportGenerator(params InvolvedType[] involvedTypes) { _readOnlyInvolvedTypeIdentifierGenerator = new IdentifierPopulator<Type> (involvedTypes.Select (i => i.Type)).GetReadonlyIdentifierGenerator ("none"); return new InvolvedTypeReportGenerator (involvedTypes, _assemblyIdentifierGenerator, _readOnlyInvolvedTypeIdentifierGenerator, _memberIdentifierGenerator, _interfaceIdentifierGenerator, _attributeIdentifierGenerator, _remotionReflector, _outputFormatter); }
public static bool SupportsIdGenWithBulkInsertion(IIdentifierGenerator generator) { return typeof(SequenceGenerator).IsAssignableFrom(generator.GetType()) || typeof(IPostInsertIdentifierGenerator).IsAssignableFrom(generator.GetType()); }
public static bool SupportsIdGenWithBulkInsertion(IIdentifierGenerator generator) { return generator is SequenceGenerator || generator is IPostInsertIdentifierGenerator; }
public void SetUp() { _assemblyIdentifierGenerator = new IdentifierGenerator<Assembly>(); }
public static AssemblyReportGenerator CreateAssemblyReportGenerator(IIdentifierGenerator<Assembly> identifierGenerator, params InvolvedType[] types) { return new AssemblyReportGenerator (types, identifierGenerator, new IdentifierGenerator<Type> ()); }
/// <summary> /// /// </summary> /// <param name="dialect"></param> /// <returns></returns> public IIdentifierGenerator CreateIdentifierGenerator( Dialect.Dialect dialect ) { if( uniqueIdentifierGenerator == null ) { uniqueIdentifierGenerator = IdentifierGeneratorFactory.Create( identifierGeneratorStrategy, type, identifierGeneratorProperties, dialect ); } return uniqueIdentifierGenerator; }
/// <summary> /// Initializes a new instance of the LinqToAstoriaParameterNameResolutionVisitor class. /// </summary> /// <param name="parameterNameGenerator">The parameter name generator.</param> public LinqToAstoriaParameterNameResolutionVisitor(IIdentifierGenerator parameterNameGenerator) { this.helper = new LinqParameterNameResolutionVisitorHelper(parameterNameGenerator); }
public AbstractCollectionPersister( Mapping.Collection collection, ISessionFactoryImplementor factory ) { this.factory = factory; dialect = factory.Dialect; //sqlExceptionConverter = factory.SQLExceptionConverter; collectionType = collection.CollectionType; role = collection.Role; ownerClass = collection.OwnerClass; Alias alias = new Alias( "__" ); sqlOrderByString = collection.OrderBy; hasOrder = sqlOrderByString != null; sqlOrderByStringTemplate = hasOrder ? Template.RenderOrderByStringTemplate( sqlOrderByString, dialect ) : null; sqlWhereString = collection.Where; hasWhere = sqlWhereString != null; sqlWhereStringTemplate = hasWhere ? Template.RenderWhereStringTemplate( sqlWhereString, dialect ) : null; hasOrphanDelete = collection.OrphanDelete; batchSize = collection.BatchSize; cache = collection.Cache; keyType = collection.Key.Type; int keySpan = collection.Key.ColumnSpan; keyColumnNames = new string[keySpan]; string[ ] keyAliases = new string[keySpan]; int k = 0; foreach( Column col in collection.Key.ColumnCollection ) { keyColumnNames[ k ] = col.GetQuotedName( dialect ); keyAliases[ k ] = col.Alias( dialect ); k++; } keyColumnAliases = alias.ToAliasStrings( keyAliases, dialect ); //unquotedKeyColumnNames = StringHelper.Unquote( keyColumnAliases ); ISet distinctColumns = new HashedSet(); CheckColumnDuplication( distinctColumns, collection.Key.ColumnCollection ); //isSet = collection.IsSet; //isSorted = collection.IsSorted; primitiveArray = collection.IsPrimitiveArray; array = collection.IsArray; IValue element = collection.Element; int elementSpan = element.ColumnSpan; ICollection iter = element.ColumnCollection; Table table = collection.CollectionTable; enableJoinedFetch = element.OuterJoinFetchSetting; elementType = element.Type; if( !collection.IsOneToMany ) { CheckColumnDuplication( distinctColumns, element.ColumnCollection ); } if( elementType.IsEntityType ) { elementPersister = factory.GetPersister( ( ( EntityType ) elementType ).AssociatedClass ); } else { elementPersister = null; } qualifiedTableName = table.GetQualifiedName( dialect, factory.DefaultSchema ); string[ ] aliases = new string[elementSpan]; elementColumnNames = new string[elementSpan]; int j = 0; foreach( Column col in iter ) { elementColumnNames[ j ] = col.GetQuotedName( dialect ); aliases[ j ] = col.Alias( dialect ); j++; } elementColumnAliases = alias.ToAliasStrings( aliases, dialect ); IType selectColumns; string[ ] selectType; hasIndex = collection.IsIndexed; if( hasIndex ) { IndexedCollection indexedCollection = ( IndexedCollection ) collection; indexType = indexedCollection.Index.Type; int indexSpan = indexedCollection.Index.ColumnSpan; indexColumnNames = new string[indexSpan]; string[ ] indexAliases = new string[indexSpan]; int i = 0; foreach( Column indexCol in indexedCollection.Index.ColumnCollection ) { indexAliases[ i ] = indexCol.Alias( dialect ); indexColumnNames[ i ] = indexCol.GetQuotedName( dialect ); i++; } selectType = indexColumnNames; selectColumns = indexType; indexColumnAliases = alias.ToAliasStrings( indexAliases, dialect ); CheckColumnDuplication( distinctColumns, indexedCollection.Index.ColumnCollection ); } else { indexType = null; indexColumnNames = null; indexColumnAliases = null; selectType = elementColumnNames; selectColumns = elementType; } hasIdentifier = collection.IsIdentified; if( hasIdentifier ) { if( collection.IsOneToMany ) { throw new MappingException( "one-to-many collections with identifiers are not supported." ); } IdentifierCollection idColl = ( IdentifierCollection ) collection; identifierType = idColl.Identifier.Type; Column col = null; foreach( Column column in idColl.Identifier.ColumnCollection ) { col = column; break; } identifierColumnName = col.GetQuotedName( dialect ); selectType = new string[ ] {identifierColumnName}; selectColumns = identifierType; identifierColumnAlias = alias.ToAliasString( col.Alias( dialect ), dialect ); unquotedIdentifierColumnName = identifierColumnAlias; identifierGenerator = idColl.Identifier.CreateIdentifierGenerator( dialect ); CheckColumnDuplication( distinctColumns, idColl.Identifier.ColumnCollection ); } else { identifierType = null; identifierColumnName = null; identifierColumnAlias = null; unquotedIdentifierColumnName = null; identifierGenerator = null; } rowSelectColumnNames = selectType; rowSelectType = selectColumns; sqlDeleteString = GenerateDeleteString(); sqlInsertRowString = GenerateInsertRowString(); sqlUpdateRowString = GenerateUpdateRowString(); sqlDeleteRowString = GenerateDeleteRowString(); isLazy = collection.IsLazy; isInverse = collection.IsInverse; if( collection.IsArray ) { elementClass = ( ( Array ) collection ).ElementClass; } else { // for non-arrays, we don't need to know the element class elementClass = null; } initializer = CreateCollectionInitializer( factory ); if( elementType.IsComponentType ) { elementPropertyMapping = new CompositeElementPropertyMapping( elementColumnNames, ( IAbstractComponentType ) elementType, factory ); } else if( !elementType.IsEntityType ) { elementPropertyMapping = new ElementPropertyMapping( elementColumnNames, elementType ); } else { IClassPersister persister = factory.GetPersister( ( ( EntityType ) elementType ).AssociatedClass ); // Not all classpersisters implement IPropertyMapping! if( persister is IPropertyMapping ) { elementPropertyMapping = ( IPropertyMapping ) persister; } else { elementPropertyMapping = new ElementPropertyMapping( elementColumnNames, elementType ); } } }
public AbstractCollectionPersister(Mapping.Collection collection, ICacheConcurrencyStrategy cache, Configuration cfg, ISessionFactoryImplementor factory) { this.factory = factory; this.cache = cache; if (factory.Settings.IsStructuredCacheEntriesEnabled) { cacheEntryStructure = collection.IsMap ? (ICacheEntryStructure) new StructuredMapCacheEntry() : (ICacheEntryStructure) new StructuredCollectionCacheEntry(); } else { cacheEntryStructure = new UnstructuredCacheEntry(); } dialect = factory.Dialect; sqlExceptionConverter = factory.SQLExceptionConverter; collectionType = collection.CollectionType; role = collection.Role; entityName = collection.OwnerEntityName; ownerPersister = factory.GetEntityPersister(entityName); queryLoaderName = collection.LoaderName; nodeName = collection.NodeName; isMutable = collection.IsMutable; Table table = collection.CollectionTable; fetchMode = collection.Element.FetchMode; elementType = collection.Element.Type; isPrimitiveArray = collection.IsPrimitiveArray; isArray = collection.IsArray; subselectLoadable = collection.IsSubselectLoadable; qualifiedTableName = table.GetQualifiedName(dialect, factory.Settings.DefaultCatalogName, factory.Settings.DefaultSchemaName); int spacesSize = 1 + collection.SynchronizedTables.Count; spaces = new string[spacesSize]; int ispa = 0; spaces[ispa++] = qualifiedTableName; foreach (string s in collection.SynchronizedTables) { spaces[ispa++] = s; } sqlOrderByString = collection.OrderBy; hasOrder = sqlOrderByString != null; sqlOrderByStringTemplate = hasOrder ? Template.RenderOrderByStringTemplate(sqlOrderByString, dialect, factory.SQLFunctionRegistry) : null; sqlWhereString = !string.IsNullOrEmpty(collection.Where) ? '(' + collection.Where + ')' : null; hasWhere = sqlWhereString != null; sqlWhereStringTemplate = hasWhere ? Template.RenderWhereStringTemplate(sqlWhereString, dialect, factory.SQLFunctionRegistry) : null; hasOrphanDelete = collection.HasOrphanDelete; int batch = collection.BatchSize; if (batch == -1) { batch = factory.Settings.DefaultBatchFetchSize; } batchSize = batch; isVersioned = collection.IsOptimisticLocked; keyType = collection.Key.Type; int keySpan = collection.Key.ColumnSpan; keyColumnNames = new string[keySpan]; keyColumnAliases = new string[keySpan]; int k = 0; foreach (Column col in collection.Key.ColumnIterator) { keyColumnNames[k] = col.GetQuotedName(dialect); keyColumnAliases[k] = col.GetAlias(dialect); k++; } ISet distinctColumns = new HashedSet(); CheckColumnDuplication(distinctColumns, collection.Key.ColumnIterator); #region Element IValue element = collection.Element; if (!collection.IsOneToMany) { CheckColumnDuplication(distinctColumns, element.ColumnIterator); } string elemNode = collection.ElementNodeName; if (elementType.IsEntityType) { string _entityName = ((EntityType) elementType).GetAssociatedEntityName(); elementPersister = factory.GetEntityPersister(_entityName); if (elemNode == null) { elemNode = cfg.GetClassMapping(_entityName).NodeName; } // NativeSQL: collect element column and auto-aliases } else { elementPersister = null; } elementNodeName = elemNode; int elementSpan = element.ColumnSpan; elementColumnAliases = new string[elementSpan]; elementColumnNames = new string[elementSpan]; elementFormulaTemplates = new string[elementSpan]; elementFormulas = new string[elementSpan]; elementColumnIsSettable = new bool[elementSpan]; elementColumnIsInPrimaryKey = new bool[elementSpan]; bool isPureFormula = true; bool hasNotNullableColumns = false; int j = 0; foreach (ISelectable selectable in element.ColumnIterator) { elementColumnAliases[j] = selectable.GetAlias(dialect); if (selectable.IsFormula) { Formula form = (Formula) selectable; elementFormulaTemplates[j] = form.GetTemplate(dialect, factory.SQLFunctionRegistry); elementFormulas[j] = form.FormulaString; } else { Column col = (Column) selectable; elementColumnNames[j] = col.GetQuotedName(dialect); elementColumnIsSettable[j] = true; elementColumnIsInPrimaryKey[j] = !col.IsNullable; if (!col.IsNullable) { hasNotNullableColumns = true; } isPureFormula = false; } j++; } elementIsPureFormula = isPureFormula; //workaround, for backward compatibility of sets with no //not-null columns, assume all columns are used in the //row locator SQL if (!hasNotNullableColumns) { ArrayHelper.Fill(elementColumnIsInPrimaryKey, true); } #endregion #region INDEX AND ROW SELECT hasIndex = collection.IsIndexed; if (hasIndex) { // NativeSQL: collect index column and auto-aliases IndexedCollection indexedCollection = (IndexedCollection) collection; indexType = indexedCollection.Index.Type; int indexSpan = indexedCollection.Index.ColumnSpan; indexColumnNames = new string[indexSpan]; indexFormulaTemplates = new string[indexSpan]; indexFormulas = new string[indexSpan]; indexColumnIsSettable = new bool[indexSpan]; indexColumnAliases = new string[indexSpan]; bool hasFormula = false; int i = 0; foreach (ISelectable selectable in indexedCollection.Index.ColumnIterator) { indexColumnAliases[i] = selectable.GetAlias(dialect); if (selectable.IsFormula) { Formula indexForm = (Formula) selectable; indexFormulaTemplates[i] = indexForm.GetTemplate(dialect, factory.SQLFunctionRegistry); indexFormulas[i] = indexForm.FormulaString; hasFormula = true; } else { Column indexCol = (Column) selectable; indexColumnNames[i] = indexCol.GetQuotedName(dialect); indexColumnIsSettable[i] = true; } i++; } indexContainsFormula = hasFormula; baseIndex = indexedCollection.IsList ? ((List) indexedCollection).BaseIndex : 0; indexNodeName = indexedCollection.IndexNodeName; CheckColumnDuplication(distinctColumns, indexedCollection.Index.ColumnIterator); } else { indexContainsFormula = false; indexColumnIsSettable = null; indexFormulaTemplates = null; indexFormulas = null; indexType = null; indexColumnNames = null; indexColumnAliases = null; baseIndex = 0; indexNodeName = null; } hasIdentifier = collection.IsIdentified; if (hasIdentifier) { if (collection.IsOneToMany) { throw new MappingException("one-to-many collections with identifiers are not supported."); } IdentifierCollection idColl = (IdentifierCollection) collection; identifierType = idColl.Identifier.Type; Column col = null; foreach (Column column in idColl.Identifier.ColumnIterator) { col = column; break; } identifierColumnName = col.GetQuotedName(dialect); identifierColumnAlias = col.GetAlias(dialect); identifierGenerator = idColl.Identifier.CreateIdentifierGenerator(factory.Dialect, factory.Settings.DefaultCatalogName, factory.Settings.DefaultSchemaName, null); // NH see : identityDelegate declaration IPostInsertIdentifierGenerator pig = (identifierGenerator as IPostInsertIdentifierGenerator); if (pig != null) { identityDelegate = pig.GetInsertGeneratedIdentifierDelegate(this, Factory, UseGetGeneratedKeys()); } else { identityDelegate = null; } CheckColumnDuplication(distinctColumns, idColl.Identifier.ColumnIterator); } else { identifierType = null; identifierColumnName = null; identifierColumnAlias = null; identifierGenerator = null; identityDelegate = null; } #endregion #region GENERATE THE SQL // NH Different behavior : for the Insert SQL we are managing isPostInsertIdentifier (not supported in H3.2.5) if (collection.CustomSQLInsert == null) { if (!IsIdentifierAssignedByInsert) { sqlInsertRowString = GenerateInsertRowString(); } else { sqlInsertRowString = GenerateIdentityInsertRowString(); } insertCallable = false; insertCheckStyle = ExecuteUpdateResultCheckStyle.Count; } else { SqlType[] parmsTypes = GenerateInsertRowString().ParameterTypes; sqlInsertRowString = new SqlCommandInfo(collection.CustomSQLInsert, parmsTypes); insertCallable = collection.IsCustomInsertCallable; insertCheckStyle = collection.CustomSQLInsertCheckStyle ?? ExecuteUpdateResultCheckStyle.DetermineDefault(collection.CustomSQLInsert, insertCallable); } sqlUpdateRowString = GenerateUpdateRowString(); if (collection.CustomSQLUpdate == null) { updateCallable = false; updateCheckStyle = ExecuteUpdateResultCheckStyle.Count; } else { sqlUpdateRowString = new SqlCommandInfo(collection.CustomSQLUpdate, sqlUpdateRowString.ParameterTypes); updateCallable = collection.IsCustomUpdateCallable; updateCheckStyle = collection.CustomSQLUpdateCheckStyle ?? ExecuteUpdateResultCheckStyle.DetermineDefault(collection.CustomSQLUpdate, updateCallable); } sqlDeleteRowString = GenerateDeleteRowString(); if (collection.CustomSQLDelete == null) { deleteCallable = false; deleteCheckStyle = ExecuteUpdateResultCheckStyle.None; } else { sqlDeleteRowString = new SqlCommandInfo(collection.CustomSQLDelete, sqlDeleteRowString.ParameterTypes); deleteCallable = collection.IsCustomDeleteCallable; deleteCheckStyle = ExecuteUpdateResultCheckStyle.None; } sqlDeleteString = GenerateDeleteString(); if (collection.CustomSQLDeleteAll == null) { deleteAllCallable = false; deleteAllCheckStyle = ExecuteUpdateResultCheckStyle.None; } else { sqlDeleteString = new SqlCommandInfo(collection.CustomSQLDeleteAll, sqlDeleteString.ParameterTypes); deleteAllCallable = collection.IsCustomDeleteAllCallable; deleteAllCheckStyle = ExecuteUpdateResultCheckStyle.None; } isCollectionIntegerIndex = collection.IsIndexed && !collection.IsMap; sqlDetectRowByIndexString = GenerateDetectRowByIndexString(); sqlDetectRowByElementString = GenerateDetectRowByElementString(); sqlSelectRowByIndexString = GenerateSelectRowByIndexString(); LogStaticSQL(); #endregion isLazy = collection.IsLazy; isExtraLazy = collection.ExtraLazy; isInverse = collection.IsInverse; if (collection.IsArray) { elementClass = ((Array) collection).ElementClass; } else { // for non-arrays, we don't need to know the element class elementClass = null; } if (elementType.IsComponentType) { elementPropertyMapping = new CompositeElementPropertyMapping(elementColumnNames, elementFormulaTemplates, (IAbstractComponentType) elementType, factory); } else if (!elementType.IsEntityType) { elementPropertyMapping = new ElementPropertyMapping(elementColumnNames, elementType); } else { elementPropertyMapping = elementPersister as IPropertyMapping; if (elementPropertyMapping == null) { elementPropertyMapping = new ElementPropertyMapping(elementColumnNames, elementType); } } // Handle any filters applied to this collection filterHelper = new FilterHelper(collection.FilterMap, dialect, factory.SQLFunctionRegistry); // Handle any filters applied to this collection for many-to-many manyToManyFilterHelper = new FilterHelper(collection.ManyToManyFilterMap, dialect, factory.SQLFunctionRegistry); manyToManyWhereString = !string.IsNullOrEmpty(collection.ManyToManyWhere) ? "( " + collection.ManyToManyWhere + " )" : null; manyToManyWhereTemplate = manyToManyWhereString == null ? null : Template.RenderWhereStringTemplate(manyToManyWhereString, factory.Dialect, factory.SQLFunctionRegistry); manyToManyOrderByString = collection.ManyToManyOrdering; manyToManyOrderByTemplate = manyToManyOrderByString == null ? null : Template.RenderOrderByStringTemplate(manyToManyOrderByString, factory.Dialect, factory.SQLFunctionRegistry); InitCollectionPropertyMap(); }
/// <summary> /// Initializes a new instance of the AddNavigationPropertyFixup class object. /// </summary> /// <param name="identifierGen">Identifier generator to use.</param> public AddNavigationPropertyFixup(IIdentifierGenerator identifierGen) { this.identifierGenerator = identifierGen; }
protected AbstractEntityPersister( PersistentClass model, ISessionFactoryImplementor factory ) { dialect = factory.Dialect; //sqlExceptionConverter = factory.SQLExceptionConverter; // CLASS className = model.MappedClass.FullName; rootClassName = model.RootClazz.Name; mappedClass = model.MappedClass; mutable = model.IsMutable; selectBeforeUpdate = model.SelectBeforeUpdate; dynamicUpdate = model.DynamicUpdate; dynamicInsert = model.DynamicInsert; sqlWhereString = model.Where; sqlWhereStringTemplate = sqlWhereString == null ? null : Template.RenderWhereStringTemplate( sqlWhereString, Dialect ); polymorphic = model.IsPolymorphic; explicitPolymorphism = model.IsExplicitPolymorphism; inherited = model.IsInherited; superclass = inherited ? model.Superclass.MappedClass : null; hasSubclasses = model.HasSubclasses; batchSize = model.BatchSize; constructor = ReflectHelper.GetDefaultConstructor( mappedClass ); abstractClass = ReflectHelper.IsAbstractClass( mappedClass ); entityType = NHibernateUtil.Entity( mappedClass ); optimisticLockMode = model.OptimisticLockMode; if( optimisticLockMode > OptimisticLockMode.Version && !dynamicUpdate ) { throw new MappingException( string.Format( "optimistic-lock setting requires dynamic-update=\'true\': {0}", className ) ); } // verify that the class has a default constructor if it is not abstract - it is considered // a mapping exception if the default ctor is missing. if( abstractClass == false && constructor == null ) { throw new MappingException( "The mapped class " + mappedClass.FullName + " must declare a default (no-arg) constructor." ); } // IDENTIFIER hasEmbeddedIdentifier = model.HasEmbeddedIdentifier; IValue idValue = model.Identifier; identifierType = idValue.Type; if( model.HasIdentifierProperty ) { Mapping.Property idProperty = model.IdentifierProperty; identifierPropertyName = idProperty.Name; identifierSetter = idProperty.GetSetter( mappedClass ); identifierGetter = idProperty.GetGetter( mappedClass ); } else { identifierPropertyName = null; identifierGetter = null; identifierSetter = null; } System.Type prox = model.ProxyInterface; MethodInfo proxySetIdentifierMethod = null; MethodInfo proxyGetIdentifierMethod = null; if( model.HasIdentifierProperty && prox != null ) { Mapping.Property idProperty = model.IdentifierProperty; PropertyInfo getIdPropertyInfo = idProperty.GetGetter( prox ).Property; if( getIdPropertyInfo != null ) { proxyGetIdentifierMethod = getIdPropertyInfo.GetGetMethod( true ); } PropertyInfo setIdPropertyInfo = idProperty.GetSetter( prox ).Property; if( setIdPropertyInfo != null ) { proxySetIdentifierMethod = setIdPropertyInfo.GetSetMethod( true ); } } // HYDRATE SPAN hydrateSpan = model.PropertyClosureCollection.Count; // IDENTIFIER int idColumnSpan = model.Identifier.ColumnSpan; identifierColumnNames = new string[idColumnSpan]; identifierAliases = new string[idColumnSpan]; int i = 0; foreach( Column col in idValue.ColumnCollection ) { identifierColumnNames[ i ] = col.GetQuotedName( Dialect ); identifierAliases[ i ] = col.Alias( Dialect ); i++; } // GENERATOR identifierGenerator = model.Identifier.CreateIdentifierGenerator( Dialect ); useIdentityColumn = identifierGenerator is IdentityGenerator; identitySelectString = useIdentityColumn ? dialect.IdentitySelectString : null; // UNSAVED-VALUE: unsavedIdentifierValue = UnsavedValueFactory.GetUnsavedIdentifierValue( model.Identifier.NullValue, identifierGetter, identifierType, constructor ); // VERSION: if( model.IsVersioned ) { foreach( Column col in model.Version.ColumnCollection ) { versionColumnName = col.GetQuotedName( Dialect ); break; //only happens once } } else { versionColumnName = null; } if( model.IsVersioned ) { //versionPropertyName = model.Version.Name; versioned = true; versionGetter = model.Version.GetGetter( mappedClass ); versionType = ( IVersionType ) model.Version.Type; } else { //versionPropertyName = null; versioned = false; versionGetter = null; versionType = null; } // VERSION UNSAVED-VALUE: unsavedVersionValue = model.IsVersioned ? UnsavedValueFactory.GetUnsavedVersionValue( model.Version.NullValue, versionGetter, versionType, constructor ) : Cascades.VersionValue.VersionUndefined; // PROPERTIES propertyTypes = new IType[hydrateSpan]; propertyNames = new string[hydrateSpan]; propertyUpdateability = new bool[hydrateSpan]; propertyInsertability = new bool[hydrateSpan]; propertyNullability = new bool[hydrateSpan]; getters = new IGetter[hydrateSpan]; setters = new ISetter[hydrateSpan]; cascadeStyles = new Cascades.CascadeStyle[hydrateSpan]; string[ ] setterNames = new string[hydrateSpan]; string[ ] getterNames = new string[hydrateSpan]; System.Type[ ] types = new System.Type[hydrateSpan]; i = 0; int tempVersionProperty = -66; bool foundCascade = false; bool foundCustomAccessor = false; foreach( Mapping.Property prop in model.PropertyClosureCollection ) { if( prop == model.Version ) { tempVersionProperty = i; } propertyNames[ i ] = prop.Name; if( !prop.IsBasicPropertyAccessor ) { foundCustomAccessor = true; } getters[ i ] = prop.GetGetter( mappedClass ); setters[ i ] = prop.GetSetter( mappedClass ); getterNames[ i ] = getters[ i ].PropertyName; setterNames[ i ] = setters[ i ].PropertyName; types[ i ] = getters[ i ].ReturnType; propertyTypes[ i ] = prop.Type; propertyUpdateability[ i ] = prop.IsUpdateable; propertyInsertability[ i ] = prop.IsInsertable; propertyNullability[ i ] = prop.IsNullable; gettersByPropertyName[ propertyNames[ i ] ] = getters[ i ]; settersByPropertyName[ propertyNames[ i ] ] = setters[ i ]; typesByPropertyName[ propertyNames[ i ] ] = propertyTypes[ i ]; cascadeStyles[ i ] = prop.CascadeStyle; if( cascadeStyles[ i ] != Cascades.CascadeStyle.StyleNone ) { foundCascade = true; } i++; } // NH: reflection optimizer works with custom accessors if( /*!foundCustomAccessor &&*/ Cfg.Environment.UseReflectionOptimizer ) { getset = GetSetHelperFactory.Create( MappedClass, Setters, Getters ); } hasCascades = foundCascade; versionProperty = tempVersionProperty; // CALLBACK INTERFACES implementsLifecycle = typeof( ILifecycle ).IsAssignableFrom( mappedClass ); implementsValidatable = typeof( IValidatable ).IsAssignableFrom( mappedClass ); cache = model.Cache; hasCollections = InitHasCollections(); // PROXIES concreteProxyClass = model.ProxyInterface; hasProxy = concreteProxyClass != null; if( hasProxy ) { HashedSet proxyInterfaces = new HashedSet(); proxyInterfaces.Add( typeof( INHibernateProxy ) ); if( !mappedClass.Equals( concreteProxyClass ) ) { if( !concreteProxyClass.IsInterface ) { throw new MappingException( "proxy must be either an interface, or the class itself: " + mappedClass.FullName ); } proxyInterfaces.Add( concreteProxyClass ); } if( mappedClass.IsInterface ) { proxyInterfaces.Add( mappedClass ); } if( hasProxy ) { foreach( Subclass subclass in model.SubclassCollection ) { System.Type subclassProxy = subclass.ProxyInterface; if( subclassProxy == null ) { throw new MappingException( "All subclasses must also have proxies: " + mappedClass.Name ); } if( !subclass.MappedClass.Equals( subclassProxy ) ) { proxyInterfaces.Add( subclassProxy ); } } } if( hasProxy ) { proxyFactory = CreateProxyFactory(); proxyFactory.PostInstantiate( mappedClass, proxyInterfaces, proxyGetIdentifierMethod, proxySetIdentifierMethod ); } else { proxyFactory = null; } } else { proxyFactory = null; } }
public AbstractCollectionPersister(Mapping.Collection collection, ICacheConcurrencyStrategy cache, ISessionFactoryImplementor factory) { this.factory = factory; dialect = factory.Dialect; this.cache = cache; //sqlExceptionConverter = factory.SQLExceptionConverter; collectionType = collection.CollectionType; role = collection.Role; ownerClass = collection.OwnerClass; ownerPersister = factory.GetEntityPersister(ownerClass); queryLoaderName = collection.LoaderName; Alias alias = new Alias("__"); sqlOrderByString = collection.OrderBy; hasOrder = sqlOrderByString != null; sqlOrderByStringTemplate = hasOrder ? Template.RenderOrderByStringTemplate(sqlOrderByString, dialect, factory.SQLFunctionRegistry) : null; sqlWhereString = collection.Where; hasWhere = sqlWhereString != null; sqlWhereStringTemplate = hasWhere ? Template.RenderWhereStringTemplate(sqlWhereString, dialect, factory.SQLFunctionRegistry) : null; hasOrphanDelete = collection.OrphanDelete; batchSize = collection.BatchSize; isVersioned = collection.IsOptimisticLocked; keyType = collection.Key.Type; int keySpan = collection.Key.ColumnSpan; keyColumnNames = new string[keySpan]; string[] keyAliases = new string[keySpan]; int k = 0; foreach (Column col in collection.Key.ColumnCollection) { keyColumnNames[k] = col.GetQuotedName(dialect); keyAliases[k] = col.GetAlias(dialect); k++; } keyColumnAliases = alias.ToAliasStrings(keyAliases, dialect); //unquotedKeyColumnNames = StringHelper.Unquote( keyColumnAliases ); ISet distinctColumns = new HashedSet(); CheckColumnDuplication(distinctColumns, collection.Key.ColumnCollection); //isSet = collection.IsSet; //isSorted = collection.IsSorted; primitiveArray = collection.IsPrimitiveArray; array = collection.IsArray; subselectLoadable = collection.IsSubselectLoadable; IValue element = collection.Element; int elementSpan = element.ColumnSpan; Table table = collection.CollectionTable; fetchMode = element.FetchMode; elementType = element.Type; if (!collection.IsOneToMany) { CheckColumnDuplication(distinctColumns, element.ColumnCollection); } if (elementType.IsEntityType) { elementPersister = factory.GetEntityPersister(((EntityType) elementType).AssociatedClass); } else { elementPersister = null; } qualifiedTableName = table.GetQualifiedName(dialect, factory.DefaultSchema); elementColumnAliases = new string[elementSpan]; elementColumnNames = new string[elementSpan]; elementFormulaTemplates = new string[elementSpan]; elementFormulas = new string[elementSpan]; elementColumnIsSettable = new bool[elementSpan]; elementColumnIsInPrimaryKey = new bool[elementSpan]; int j = 0; foreach (ISelectable selectable in element.ColumnCollection) { elementColumnAliases[j] = selectable.GetAlias(dialect); if (selectable.IsFormula) { Formula form = (Formula) selectable; elementFormulaTemplates[j] = form.GetTemplate(dialect, factory.SQLFunctionRegistry); elementFormulas[j] = form.FormulaString; } else { Column col = (Column) selectable; elementColumnNames[j] = col.GetQuotedName(dialect); elementColumnIsSettable[j] = true; elementColumnIsInPrimaryKey[j] = !col.IsNullable; } j++; } hasIndex = collection.IsIndexed; if (hasIndex) { IndexedCollection indexedCollection = (IndexedCollection) collection; indexType = indexedCollection.Index.Type; int indexSpan = indexedCollection.Index.ColumnSpan; indexColumnNames = new string[indexSpan]; string[] indexAliases = new string[indexSpan]; int i = 0; foreach (Column indexCol in indexedCollection.Index.ColumnCollection) { indexAliases[i] = indexCol.GetAlias(dialect); indexColumnNames[i] = indexCol.GetQuotedName(dialect); i++; } indexColumnAliases = alias.ToAliasStrings(indexAliases, dialect); CheckColumnDuplication(distinctColumns, indexedCollection.Index.ColumnCollection); } else { indexType = null; indexColumnNames = null; indexColumnAliases = null; } hasIdentifier = collection.IsIdentified; if (hasIdentifier) { if (collection.IsOneToMany) { throw new MappingException("one-to-many collections with identifiers are not supported."); } IdentifierCollection idColl = (IdentifierCollection) collection; identifierType = idColl.Identifier.Type; Column col = null; foreach (Column column in idColl.Identifier.ColumnCollection) { col = column; break; } identifierColumnName = col.GetQuotedName(dialect); identifierColumnAlias = alias.ToAliasString(col.GetAlias(dialect), dialect); identifierGenerator = idColl.Identifier.CreateIdentifierGenerator(dialect); CheckColumnDuplication(distinctColumns, idColl.Identifier.ColumnCollection); } else { identifierType = null; identifierColumnName = null; identifierColumnAlias = null; identifierGenerator = null; } sqlInsertRowString = GenerateInsertRowString(); if (collection.CustomSQLInsert == null) { insertCallable = false; insertCheckStyle = ExecuteUpdateResultCheckStyle.Count; } else { sqlInsertRowString = new SqlCommandInfo(collection.CustomSQLInsert, sqlInsertRowString.ParameterTypes); insertCallable = collection.IsCustomInsertCallable; insertCheckStyle = collection.CustomSQLInsertCheckStyle == null ? ExecuteUpdateResultCheckStyle.DetermineDefault(collection.CustomSQLInsert, insertCallable) : collection.CustomSQLInsertCheckStyle; } sqlUpdateRowString = GenerateUpdateRowString(); if (collection.CustomSQLUpdate == null) { updateCallable = false; updateCheckStyle = ExecuteUpdateResultCheckStyle.Count; } else { sqlUpdateRowString = new SqlCommandInfo(collection.CustomSQLUpdate, sqlUpdateRowString.ParameterTypes); updateCallable = collection.IsCustomUpdateCallable; updateCheckStyle = collection.CustomSQLUpdateCheckStyle == null ? ExecuteUpdateResultCheckStyle.DetermineDefault(collection.CustomSQLUpdate, updateCallable) : collection.CustomSQLUpdateCheckStyle; } sqlDeleteRowString = GenerateDeleteRowString(); if (collection.CustomSQLDelete == null) { deleteCallable = false; deleteCheckStyle = ExecuteUpdateResultCheckStyle.None; } else { sqlDeleteRowString = new SqlCommandInfo(collection.CustomSQLDelete, sqlDeleteRowString.ParameterTypes); deleteCallable = collection.IsCustomDeleteCallable; deleteCheckStyle = ExecuteUpdateResultCheckStyle.None; } sqlDeleteString = GenerateDeleteString(); if (collection.CustomSQLDeleteAll == null) { deleteAllCallable = false; deleteAllCheckStyle = ExecuteUpdateResultCheckStyle.None; } else { sqlDeleteString = new SqlCommandInfo(collection.CustomSQLDeleteAll, sqlDeleteString.ParameterTypes); deleteAllCallable = collection.IsCustomDeleteAllCallable; deleteAllCheckStyle = ExecuteUpdateResultCheckStyle.None; } isLazy = collection.IsLazy; isInverse = collection.IsInverse; if (collection.IsArray) { elementClass = ((Array) collection).ElementClass; } else { // for non-arrays, we don't need to know the element class elementClass = null; } if (elementType.IsComponentType) { elementPropertyMapping = new CompositeElementPropertyMapping( elementColumnNames, elementFormulaTemplates, (IAbstractComponentType) elementType, factory); } else if (!elementType.IsEntityType) { elementPropertyMapping = new ElementPropertyMapping(elementColumnNames, elementType); } else { IEntityPersister persister = factory.GetEntityPersister(((EntityType) elementType).AssociatedClass); // Not all classpersisters implement IPropertyMapping! if (persister is IPropertyMapping) { elementPropertyMapping = (IPropertyMapping) persister; } else { elementPropertyMapping = new ElementPropertyMapping(elementColumnNames, elementType); } } // Handle any filters applied to this collection filterHelper = new FilterHelper(collection.FilterMap, dialect, factory.SQLFunctionRegistry); // Handle any filters applied to this collection for many-to-many manyToManyFilterHelper = new FilterHelper(collection.ManyToManyFilterMap, dialect, factory.SQLFunctionRegistry); manyToManyWhereString = StringHelper.IsNotEmpty(collection.ManyToManyWhere) ? "( " + collection.ManyToManyWhere + " )" : null; manyToManyWhereTemplate = manyToManyWhereString == null ? null : Template.RenderWhereStringTemplate(manyToManyWhereString, factory.Dialect, factory.SQLFunctionRegistry); // , factory.getSqlFunctionRegistry() ); manyToManyOrderByString = collection.ManyToManyOrdering; manyToManyOrderByTemplate = manyToManyOrderByString == null ? null : Template.RenderOrderByStringTemplate(manyToManyOrderByString, factory.Dialect, factory.SQLFunctionRegistry); // , factory.getSqlFunctionRegistry() ); InitCollectionPropertyMap(); }