【发布时间】:2010-12-20 09:34:36
【问题描述】:
我正在尝试在 NHibernate 中编写查询。我真的不在乎我是使用 Criteria API 还是 HQL,我只是不知道如何编写查询。
这是我的模型:
public class LogEntry { public DateTime TimeCreated { get; set; } }
public class Note : LogEntry { public string Content { get; set; } }
public class Workflow { public IList<LogEntry> Log { get; set; } }
我希望查询返回包含注释的所有工作流,其中注释的内容中包含特定单词。
在伪 SQL 中,我会这样写:
select w.*
from Workflow w
join w.Log l where l is class:Note
where (Note)l.Content like '%keyword%'
【问题讨论】:
标签: nhibernate hibernate hql criteria