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
데이터베이스 테이블을 검사했는데 잘못된 것이 있다고 생각하지 않습니다. 어떤 아이디어?