草庐IT

query-parameters

全部标签

java - org.springframework.dao.InvalidDataAccessApiUsageException : No value supplied for the SQL parameter

我正在使用BeanPropertySqlParameterSource和SqlParameterSource开发SpringJDBC示例。当我运行我的代码时,我看到出现以下错误。花了几个小时后,我没有找到它的解决方案。有什么问题请指点。org.springframework.dao.InvalidDataAccessApiUsageException:NovaluesuppliedfortheSQLparameter'employeeId':Invalidproperty'employeeId'ofbeanclass[com.spring.jdbc.model.Order]:Beanp

java - 每个子类继承关系表 : How to query against the Parent class without loading any subclass ? ?? ( hibernate )

假设一个每个子类继承关系的表可以在下面描述(来自wikibooks.org-参见here)注意父类不是抽象的@Entity@Inheritance(strategy=InheritanceType.JOINED)publicclassProject{@Idprivatelongid;//Otherproperties}@Entity@Table(name="LARGEPROJECT")publicclassLargeProjectextendsProject{privateBigDecimalbudget;}@Entity@Table(name="SMALLPROJECT")publi

java - 解释警告 : non-varargs call of varargs method with inexact argument type for last parameter

这个问题在这里已经有了答案:WhydoIgetacompilationwarninghere(varargsmethodcallinJava)(5个答案)关闭6年前。这是我收到警告的示例代码。StringlsSQL=foMetaQuery.getSQL();StringlsNewSQL=replace(lsSQL,"''{","''{");lsNewSQL=replace(lsNewSQL,"}''","}''");lsNewSQL=replace(lsNewSQL,"}","}");lsNewSQL=MessageFormat.format(lsNewSQL,foSubstituti

java - OffsetDateTime 在 GET 方法中产生 "No injection source found for a parameter of type public javax.ws.rs.core.response"

我有以下GETREST方法:importjava.time.OffsetDateTime;importjavax.ws.rs.Consumes;importjavax.ws.rs.DELETE;importjavax.ws.rs.GET;importjavax.ws.rs.HeaderParam;importjavax.ws.rs.POST;importjavax.ws.rs.PUT;importjavax.ws.rs.Path;importjavax.ws.rs.PathParam;importjavax.ws.rs.Produces;importjavax.ws.rs.QueryP

java - Spring 数据 : is it possible to have subqueries in the Query annotation?

我想知道是否可以在@Query注释中包含子查询(org.springframework.data.jpa.repository.Query;)我在第一个子查询括号中收到QuerySyntaxException。这是我的问题@Query(value="selectc1fromComplaintModelc1,"+"(selectc2.id,min(cb.termDate)minDatefromComplaintModelc2"+"joinc2.complaintBulletscbjoincb.statusswheres.code=?1"+"groupbyc2.id)tmpwherec1.

Java 多态性 : How can I avoid type casting input parameters?

假设我们有一个带有compare()函数的Parent接口(interface)。publicinterfaceParent{publicintcompare(ParentotherParent);}假设childChild1、Child2、Child3实现了这个接口(interface)ParentpublicclassChild1implementsParent{@Overridepublicintcompare(Parentother){Child1otherChild=(Child1)other;}}此外,我正在使用泛型代码中的其他地方。所以我需要从代码的其他部分比较两个类型为

java - Hibernate Criteria Query - 嵌套条件

我不知道如何使用HibernateCriteriasynthax创建这样的查询select*fromxwherex.a='abc'and(x.b='def'orx.b='ghi')你知道怎么做吗?我正在使用HibernateRestriction静态方法,但我不明白如何指定嵌套的“或”条件 最佳答案 您的具体查询可以是:crit.add(Restrictions.eq("a","abc"));crit.add(Restrictions.in("b",newString[]{"def","ghi"});如果您想了解一般的AND和OR,

java - JPQL 检查大于小于今天@Query 注解中的日期

我想使用JPQL检查天气validTill日期是否大于today。我知道我可以通过跟随来实现这一目标。Queryq=em.createQuery("selectefromMyEntityewheree.validTill>:today");并传递:today参数。但这不是我想要的。我想在Spring中使用CrudRepository中的@Query注释来做到这一点。这是我在CrudRepository中的代码段@Query("SELECTeFROMMyEntityeWHEREe.validFromfindAllValid();我不知道应该在TODAY位置放什么来获取今天的日期。请帮助我

Java XPath : Queries with default namespace xmlns

我想对此文件执行XPath查询(显示摘录):这是我正在使用的代码片段:DocumentBuilderFactorydomFactory=DocumentBuilderFactory.newInstance();DocumentBuilderbuilder=domFactory.newDocumentBuilder();Documentdocument=builder.parse(newFile(testFile));XPathFactoryfactory=XPathFactory.newInstance();XPathxpath=factory.newXPath();xpath.set

java - query.list 和 query.iterate 的区别

使用Query.list()到底有什么区别?和Query.iterator()?使用其中任何一个是否有任何性能增强。我的意思是他们中的任何一个都在实现lazyloading?或者是Query.iterator()最终与query.list().iterate()相同还有为什么没有Criteria.iterator()只有Criteria.list() 最佳答案 Query.list():执行1个SQL查询并加载整个数据。即使记录存在于缓存中,也会执行新的SQL查询以从数据库加载记录。Listlist1=session.createQ