Subsequent update of generated property fails because of syntax error in select statement
Description
The following entity
namespace DAL { public class Group { private Guid id = Guid.Empty; private byte[] version = null; private string name = String.Empty; private int count = 0;
public Group( string name ) { this.Name = name; }
public virtual Guid Id { get { return this.id; } }
public virtual byte[] Version { get { return this.version; } }
public virtual string Name { get { return this.name; } set { this.name = value; } }
public virtual int Count { get { return this.count; } } } }
produces a syntax error in the select statement after updating the entity on the subsequent update of the generated properties: syntax error looks something like
SELECT group.Version as Version10_ group. as formula0_ FROM [Group] group WHERE group.GroupID=?
The following entity
namespace DAL
{
public class Group
{
private Guid id = Guid.Empty;
private byte[] version = null;
private string name = String.Empty;
private int count = 0;
public Group( string name )
{
this.Name = name;
}
public virtual Guid Id
{
get { return this.id; }
}
public virtual byte[] Version
{
get { return this.version; }
}
public virtual string Name
{
get { return this.name; }
set { this.name = value; }
}
public virtual int Count
{
get { return this.count; }
}
}
}
along with its corresponding nhibernate mapping
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" namespace="DAL" assembly="DAL">
<class name="Group" table="[Group]" optimistic-lock="version" lazy="false">
<!-- identity -->
<id name="Id" type="Guid" column="[GroupID]" access="nosetter.camelcase" unsaved-value="00000000-0000-0000-0000-000000000000">
<generator class="guid.comb"/>
</id>
<version name="Version" column="Version" type="DAL.SqlTimestampType,DAL" access="nosetter.camelcase" generated="always" unsaved-value="null"/>
<!-- properties -->
<property name="Name" column="[Name]" type="System.String"/>
<property name="Count" formula="( SELECT dbo.CountMachines( GroupID ) )" type="System.Int32" insert="false" update="false" access="nosetter.camelcase" generated="always" optimistic-lock="false"/>
</class>
</hibernate-mapping>
produces a syntax error in the select statement after updating the entity on the subsequent update of the generated properties: syntax error looks something like
SELECT group.Version as Version10_ group. as formula0_ FROM [Group] group WHERE group.GroupID=?