0
私はVideoCategoryとGroupにマップされたVideoAssetというエンティティを持っています。どちらも、多くの多くのとおりです。奇妙なエイリアスを持つ不正なSQLクエリを生成するnhibernate
public class VideoAssetMap : IAutoMappingOverride<VideoAsset>
{
public void Override(AutoMapping<VideoAsset> mapping)
{
mapping.Map(x => x.Description)
.CustomSqlType("NTEXT");
mapping.HasManyToMany<Group>(x => x.Groups)
.Table("VideoAssetGroups")
.ParentKeyColumn("VideoAssetId")
.ChildKeyColumn("GroupId")
.AsSet();
mapping.HasManyToMany<VideoCategory>(x => x.Categories)
.Table("VideoCategoryRel")
.ParentKeyColumn("VideoCategoryId")
.ChildKeyColumn("VideoAssetId")
.AsSet();
}
}
私は、以下のものを使用してsqliteのとNUnitの中に次のクエリを実行しようとすると:それは壊れているため
ICriteria query = this.Session.CreateCriteria<VideoAsset>("a")
.CreateAlias("a.Categories", "c")
.CreateAlias("a.Groups", " ag")
.Add(Restrictions.Eq("c.Id", category.Id))
.Add(Restrictions.Eq("a.Enabled", true));
私のSQLを実行することはできません。
inner join Groups alias_ ag2_ on groups4_.GroupId=alias_ ag2_.GroupId
私は自分のデータベーステーブルをチェックしましたが、何か問題はないと思います。何か案は?