代码改变世界

Active record 中如何执行多对多的关联查询?

2007-07-18 23:20  爱车龟速兔  阅读(287)  评论(0编辑  收藏  举报

SimpleQuery query = new SimpleQuery(typeof(FunctionOperation),

@"FROM FunctionOperation o INNER JOIN FETCH o.RoleUsers r WHERE r.UserName=? ORDER BY  o.FunOperationID", userName);

FunctionOperation[] arrUserFunctionOperation = (FunctionOperation[])FunctionOperation.ExecuteQuery(query);