本文整理了Java中org.hibernate.criterion.Restrictions.isNotNull
方法的一些代码示例,展示了Restrictions.isNotNull
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Restrictions.isNotNull
方法的具体详情如下:
包路径:org.hibernate.criterion.Restrictions
类名称:Restrictions
方法名:isNotNull
[英]Apply an "is not null" constraint to the named property
[中]对命名属性应用“is not null”约束
代码示例来源:origin: hibernate/hibernate-orm
/**
* Creates a NOT NULL restriction
*
* @return The restriction
*
* @see Restrictions#isNotNull(String)
*/
public Criterion isNotNull() {
return Restrictions.isNotNull( getPropertyName() );
}
代码示例来源:origin: hibernate/hibernate-orm
/**
* Apply a "not equal" constraint to the named property. If the value
* is null, instead apply "is not null".
*
* @param propertyName The name of the property
* @param value The value to use in comparison
*
* @return The Criterion
*
* @see #ne
* @see #isNotNull
*/
public static Criterion neOrIsNotNull(String propertyName, Object value) {
return value == null
? isNotNull( propertyName )
: ne( propertyName, value );
}
代码示例来源:origin: kaaproject/kaa
@Override
public List<CtlSchemaMetaInfo> findSiblingsByFqnTenantIdAndApplicationId(
String fqn, String tenantId, String applicationId) {
LOG.debug("Searching siblings of ctl by fqn [{}], tenantId [{}] and applicationId [{}]",
fqn, tenantId, applicationId);
List<CtlSchemaMetaInfo> ctlSchemaMetaInfos;
if (isNotBlank(fqn) && isNotBlank(tenantId) && isNotBlank(applicationId)) {
ctlSchemaMetaInfos = findListByCriterion(
Restrictions.and(
Restrictions.eq(CTL_SCHEMA_META_INFO_FQN, fqn),
Restrictions.eq(CTL_SCHEMA_META_INFO_TENANT_ID_ALIAS, Long.valueOf(tenantId)),
Restrictions.isNotNull(CTL_SCHEMA_META_INFO_APPLICATION_ID_ALIAS),
Restrictions.ne(CTL_SCHEMA_META_INFO_APPLICATION_ID_ALIAS,
Long.valueOf(applicationId))
));
} else {
ctlSchemaMetaInfos = Collections.emptyList();
}
if (LOG.isTraceEnabled()) {
LOG.trace("[{}][{}][{}] Search result: [{}].",
fqn, tenantId, applicationId, Arrays.toString(ctlSchemaMetaInfos.toArray()));
} else {
LOG.debug("[{}][{}][{}] Search result: [{}].",
fqn, tenantId, applicationId, ctlSchemaMetaInfos.size());
}
return ctlSchemaMetaInfos;
}
代码示例来源:origin: kaaproject/kaa
private Criterion buildExludingSearchCriterion(
String fqn, String excludingTenantId, String excludingApplicationId) {
List<Criterion> searchCriterions = new ArrayList<>();
if (isNotBlank(excludingTenantId)) {
searchCriterions.add(Restrictions.isNull(CTL_SCHEMA_META_INFO_TENANT_ID_ALIAS));
if (isNotBlank(excludingApplicationId)) {
searchCriterions.add(Restrictions.and(
Restrictions.eq(CTL_SCHEMA_META_INFO_TENANT_ID_ALIAS, Long.valueOf(excludingTenantId)),
Restrictions.isNull(CTL_SCHEMA_META_INFO_APPLICATION_ID_ALIAS)));
} else {
searchCriterions.add(Restrictions.and(
Restrictions.eq(CTL_SCHEMA_META_INFO_TENANT_ID_ALIAS, Long.valueOf(excludingTenantId)),
Restrictions.isNotNull(CTL_SCHEMA_META_INFO_APPLICATION_ID_ALIAS)));
}
} else {
searchCriterions.add(Restrictions.isNotNull(CTL_SCHEMA_META_INFO_TENANT_ID_ALIAS));
}
return Restrictions.and(Restrictions.eq(CTL_SCHEMA_META_INFO_FQN, fqn),
Restrictions.or(searchCriterions.toArray(new Criterion[searchCriterions.size()])));
}
代码示例来源:origin: hibernate/hibernate-orm
.add( Restrictions.eq( "boolean", f.getBoolean() ) )
.add( Restrictions.isNotNull("boolean") )
.list();
assertTrue( list.size() == 1 && list.get( 0 ) == f );
.add( Restrictions.like( "string", f.getString() ) )
.add( Restrictions.in( "boolean", f.getBoolean(), f.getBoolean() ) )
.add( Restrictions.isNotNull("foo") )
.setFetchMode( "foo", FetchMode.JOIN )
.setFetchMode( "baz", FetchMode.SELECT )
代码示例来源:origin: hibernate/hibernate-orm
t = s.beginTransaction();
holder1 = ( EntityWithFunctionAsColumnHolder ) s.createCriteria( EntityWithFunctionAsColumnHolder.class )
.add( Restrictions.isNotNull( "nextHolder" ))
.setFetchMode( "entityWithNoArgFunctionAsColumns", FetchMode.JOIN )
.setFetchMode( "nextHolder", FetchMode.JOIN )
代码示例来源:origin: hibernate/hibernate-orm
t = s.beginTransaction();
holder1 = ( EntityWithFunctionAsColumnHolder ) s.createCriteria( EntityWithFunctionAsColumnHolder.class )
.add( Restrictions.isNotNull( "nextHolder" ))
.setFetchMode( "entityWithArgFunctionAsColumns", FetchMode.JOIN )
.setFetchMode( "nextHolder", FetchMode.JOIN )
代码示例来源:origin: bill1012/AdminEAP
@Override
public DetachedCriteria getCriteria(DetachedCriteria criteria, String key, Object value)
throws QueryException {
criteria.add(Restrictions.isNotNull(key));
return criteria;
}
};
代码示例来源:origin: openmrs/openmrs-core
/**
* @see org.openmrs.api.db.ConceptDAO#getProposedConcepts(java.lang.String)
*/
@Override
@SuppressWarnings("unchecked")
public List<Concept> getProposedConcepts(String text) throws DAOException {
Criteria crit = sessionFactory.getCurrentSession().createCriteria(ConceptProposal.class);
crit.add(Restrictions.ne("state", OpenmrsConstants.CONCEPT_PROPOSAL_UNMAPPED));
crit.add(Restrictions.eq("originalText", text));
crit.add(Restrictions.isNotNull("mappedConcept"));
crit.setProjection(Projections.distinct(Projections.property("mappedConcept")));
return crit.list();
}
代码示例来源:origin: openmrs/openmrs-core
private Criterion getCriterionForShortName(String name, boolean includeVoided) {
Criterion criterion = Restrictions.disjunction().add(
Restrictions.conjunction().add(Restrictions.isNotNull("name.givenName")).add(
Restrictions.eq("name.givenName", name).ignoreCase())).add(
Restrictions.conjunction().add(Restrictions.isNotNull("name.middleName")).add(
Restrictions.eq("name.middleName", name).ignoreCase())).add(
Restrictions.conjunction().add(Restrictions.isNotNull("name.familyName")).add(
Restrictions.eq("name.familyName", name).ignoreCase())).add(
Restrictions.conjunction().add(Restrictions.isNotNull("name.familyName2")).add(
Restrictions.eq("name.familyName2", name).ignoreCase()));
if (!includeVoided) {
return Restrictions.conjunction().add(Restrictions.eq("name.voided", false)).add(criterion);
}
return criterion;
}
代码示例来源:origin: openmrs/openmrs-core
private Criterion getCriterionForNoExactName(String name, boolean includeVoided) {
MatchMode matchMode = getMatchMode();
Criterion criterion = Restrictions.conjunction().add(
Restrictions.disjunction().add(
Restrictions.conjunction().add(Restrictions.isNotNull("name.givenName")).add(
Restrictions.like("name.givenName", name, matchMode))).add(
Restrictions.conjunction().add(Restrictions.isNotNull("name.middleName")).add(
Restrictions.like("name.middleName", name, matchMode))).add(
Restrictions.conjunction().add(Restrictions.isNotNull("name.familyName")).add(
Restrictions.like("name.familyName", name, matchMode))).add(
Restrictions.conjunction().add(Restrictions.isNotNull("name.familyName2")).add(
Restrictions.like("name.familyName2", name, matchMode)))).add(
Restrictions.disjunction().add(Restrictions.isNull("name.givenName")).add(
Restrictions.ne("name.givenName", name))).add(
Restrictions.disjunction().add(Restrictions.isNull("name.middleName")).add(
Restrictions.ne("name.middleName", name))).add(
Restrictions.disjunction().add(Restrictions.isNull("name.familyName")).add(
Restrictions.ne("name.familyName", name))).add(
Restrictions.disjunction().add(Restrictions.isNull("name.familyName2")).add(
Restrictions.ne("name.familyName2", name)));
if (!includeVoided) {
return Restrictions.conjunction().add(Restrictions.eq("name.voided", false)).add(criterion);
}
return criterion;
}
代码示例来源:origin: denimgroup/threadfix
@SuppressWarnings("unchecked")
@Override
public List<RemoteProviderApplication> retrieveAllWithMappings() {
return (List<RemoteProviderApplication>) getActiveRPACriteria()
.add(Restrictions.isNotNull("application"))
.list();
}
代码示例来源:origin: denimgroup/threadfix
@SuppressWarnings("unchecked")
@Override
public List<Finding> retrieveFindingsByScanIdAndPage(Integer scanId,
int page) {
return getScanIdAndPageCriteria(scanId, page)
.add(Restrictions.isNotNull("vulnerability"))
.list();
}
代码示例来源:origin: org.n52.sensorweb/timeseries-series-dao
private Criteria addIgnoreNonPublishedSeriesTo(Criteria criteria, String alias) {
alias = alias == null ? "" : alias + ".";
criteria.add(Restrictions.and(
Restrictions.and(
Restrictions.isNotNull(alias + "firstValue"),
Restrictions.isNotNull(alias + "lastValue")),
Restrictions.eq(alias + "published", true),
Restrictions.eqOrIsNull(alias + "deleted", false)));
return criteria;
}
代码示例来源:origin: com.atlassian.crowd/crowd-persistence-hibernate5
@Nonnull
@Override
@SuppressWarnings("unchecked")
public Set<String> getAllExternalIds(long directoryId) throws DirectoryNotFoundException {
getDirectory(directoryId);
return ImmutableSet.<String>copyOf(session().createCriteria(InternalUser.class)
.add(Restrictions.eq(DIRECTORY_ID, directoryId))
.add(Restrictions.isNotNull(EXTERNAL_ID))
.setProjection(Projections.property(EXTERNAL_ID))
.list());
}
代码示例来源:origin: denimgroup/threadfix
@Override
public List<GenericVulnerability> retrieveAllWithCustomText() {
return sessionFactory.getCurrentSession().createCriteria(GenericVulnerability.class)
.add(Restrictions.isNotNull("customText"))
.addOrder(Order.asc("id"))
.list();
}
代码示例来源:origin: org.grails/grails-hibernate
@Override
public Query isNotNull(String property) {
addToCriteria(Restrictions.isNotNull(calculatePropertyName(property)));
return this;
}
代码示例来源:origin: org.grails/grails-datastore-gorm-hibernate-core
@Override
public Query isNotNull(String property) {
addToCriteria(Restrictions.isNotNull(calculatePropertyName(property)));
return this;
}
代码示例来源:origin: uk.ac.ebi.intact.dbupdate/intact-update-model
@Override
public List<UniprotUpdateEvent> getUniprotUpdateEventWithUpdatedShortLabel(long processId) {
return getSession().createCriteria(getEntityClass()).
createAlias("updateProcess", "p").add(Restrictions.eq("p.id", processId)).
add(Restrictions.isNotNull("updatedShortLabel"))
.addOrder(Order.asc("eventDate")).list();
}
代码示例来源:origin: denimgroup/threadfix
private Criteria getBasicMapCriteria() {
DetachedCriteria detachedCriteria = DetachedCriteria.forClass(StatisticsCounter.class)
.createAlias("scanRepeatFindingMap", "mapAlias")
.add(Restrictions.isNotNull("scanRepeatFindingMap"))
.setProjection(property("mapAlias.id"));
return sessionFactory.getCurrentSession()
.createCriteria(ScanRepeatFindingMap.class)
.add(Property.forName("id").notIn(detachedCriteria));
}
内容来源于网络,如有侵权,请联系作者删除!