本文整理了Java中leap.orm.query.Query.singleOrNull
方法的一些代码示例,展示了Query.singleOrNull
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.singleOrNull
方法的具体详情如下:
包路径:leap.orm.query.Query
类名称:Query
方法名:singleOrNull
[英]Executes this query and return the first row.
Returns null
if no result returned.
[中]执行此查询并返回第一行。
如果没有返回结果,则返回null
。
代码示例来源:origin: org.leapframework/leap-websecurity
@Override
public UserDetails loadUserDetailsById(Object userId) {
return lazyDao.get()
.createNamedQuery(SQL_KEY_FIND_USER_DETAILS_BY_ID, SimpleUserDetails.class)
.param(SQL_PARAM_USER_ID, userId)
.singleOrNull();
}
代码示例来源:origin: org.leapframework/leap-websecurity
@Override
public UserDetails loadUserDetailsByLoginName(String username) {
return lazyDao.get()
.createNamedQuery(SQL_KEY_FIND_USER_DETAILS_BY_LOGIN_NAME, SimpleUserDetails.class)
.param(SQL_PARAM_LOGIN_NAME, username)
.singleOrNull();
}
代码示例来源:origin: org.leapframework/leap-oauth2-server
@Override
public AuthzSSOSession loadSessionById(String id) {
AuthzSSOSessionEntity session = null;
if(null != loadSessionByIdCommand) {
session = dao.createQuery(AuthzSSOSessionEntity.class, loadSessionByIdCommand).singleOrNull();
}else{
session = dao.createCriteriaQuery(AuthzSSOSessionEntity.class)
.where("id = ? and expiration > ?", new Object[]{id, new Date()})
.singleOrNull();
}
if(null == session) {
return null;
}
return createSessionFromEntity(session);
}
代码示例来源:origin: org.leapframework/leap-oauth2-server
@Override
public AuthzSSOSession loadSessionByToken(String username, String token) {
AuthzSSOSessionEntity session = null;
if(null != loadSessionByTokenCommand) {
session = dao.createQuery(AuthzSSOSessionEntity.class, loadSessionByTokenCommand).singleOrNull();
}else{
session = dao.createCriteriaQuery(AuthzSSOSessionEntity.class)
.where("token = ? and user_name = ? and expiration > ?", new Object[]{token, username, new Date()})
.firstOrNull();
}
if(null == session) {
return null;
}
return createSessionFromEntity(session);
}
代码示例来源:origin: org.leapframework/leap-oauth2
@Override
public AuthzSSOSession loadSessionByToken(String username, String token) {
AuthzSSOSessionEntity session = null;
if(null != loadSessionByTokenCommand) {
session = dao.createQuery(AuthzSSOSessionEntity.class, loadSessionByTokenCommand).singleOrNull();
}else{
session = dao.createCriteriaQuery(AuthzSSOSessionEntity.class)
.where("token = ? and user_name = ? and expiration > ?", new Object[]{token, username, new Date()})
.firstOrNull();
}
if(null == session) {
return null;
}
return createSessionFromEntity(session);
}
代码示例来源:origin: org.leapframework/leap-oauth2
@Override
public AuthzSSOSession loadSessionById(String id) {
AuthzSSOSessionEntity session = null;
if(null != loadSessionByIdCommand) {
session = dao.createQuery(AuthzSSOSessionEntity.class, loadSessionByIdCommand).singleOrNull();
}else{
session = dao.createCriteriaQuery(AuthzSSOSessionEntity.class)
.where("id = ? and expiration > ?", new Object[]{id, new Date()})
.singleOrNull();
}
if(null == session) {
return null;
}
return createSessionFromEntity(session);
}
内容来源于网络,如有侵权,请联系作者删除!