假设我的域对象declare @valueToFind nvarchar(10) = 'something'
, @date DateTime = '2018-01-01'
if exists (select top 1 1 from TablelistingValidValues where AValue = @value)
begin
if exists (select top 1 1 from TableWithActualData where AValue = @value and ADate = @date)
begin
select *
from TableWithActualData
where AValue = @value
and ADate = @date
end
else
begin
throw 50001, 'The record does not exist on the given date.', 1
end
end
else
begin
throw 50000, 'The record does not exist / AValue is invalid.', 1
end
包含子项Publication
,但不是相反。
Request
我正在围绕public class Publication implements java.io.Serializable {
private Request request;
//...
}
public class Request implements java.io.Serializable {
//...
}
对象建立一个Criteria API查询,因为那是查询的“核心”。
我需要在发布表上进行联接,并包括其字段PUBLICATION_DATE字段。但我不能这样做:
Request
Criteria criteriaQuery = session.createCriteria(Request.class);
//...
criteriaQuery.createAlias("publication", "pub", JoinType.INNER_JOIN);
criteriaQuery.add(Restrictions.eq("pub.PUBLICATION_DATE", "..."));
没有Request
的子对象。我想做一个简单的JOIN,但是唯一的方法似乎是从根开始通过Publication
。有解决方案吗?