问题描述
如何在春季启动时使用 NSError *bookMarkError;
NSData *bookmarkData = [url bookmarkDataWithOptions:NSURLBookmarkCreationMinimalBookmark
includingResourceValuesForKeys: nil
relativetoURL:nil
error:&bookMarkError];
BOOL isstale = false;
BOOL isScopedURL = false;
NSError *error;
NSURL *resolvedURL = [NSURL URLByResolvingBookmarkData:bookmarkData
options: 0
relativetoURL:nil
bookmarkDataIsstale:&isstale
error:&error];
if (isstale)
{
}
if (error)
{
}
// Note that it does not come back as stale,and I don't get any error
if (resolvedURL)
{
BOOL accessGranted = [resolvedURL startAccessingSecurityScopedResource]; //<==== returns false
accessGranted = [url startAccessingSecurityScopedResource]; //<===== returns true
}
和distinct
编写jpa查询?下面是示例。
not null
@H_502_11@如何在jpa中编写以上查询。
我在这里
select distinct job from emp where job is not null
尝试过findByJobNotNull()
正常,但是需要null
怎么做,请提出建议。解决方法
只需将
#include
添加到方法名称,Distinct
- 您可以使用以下查询:
@Query("select distinct e.job from Employee e where e.job is not null") List<String> findJobs();
- 您可以使用projections。
假设您拥有:
@Entity class Employee { // ... @Column(name = "job") public String getJob() { return job; } }
您可以创建基于接口的投影:
public interface EmployeeJob { String getJob(); }
,然后将以下方法添加到您的Employee存储库:
List<EmployeeJob> findDistinctByJobNotNull();
您可以在documentation中找到其他信息。