Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/379.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 我的查询不起作用。“类型”;“双”字;不存在_Java_Spring_Hibernate_Postgresql_Jpa - Fatal编程技术网

Java 我的查询不起作用。“类型”;“双”字;不存在

Java 我的查询不起作用。“类型”;“双”字;不存在,java,spring,hibernate,postgresql,jpa,Java,Spring,Hibernate,Postgresql,Jpa,我试过: @Query("SELECT AVG(a.unitPrice) FROM ConnectwiseAgreementAdditions a WHERE a.agreementId = :agreementId " + "AND a.productId IN (SELECT p.id FROM ConnectwiseProductFindResult p " + "WHERE LOWER(p.subCategory) LIKE LOWER('%server%

我试过:

@Query("SELECT AVG(a.unitPrice) FROM ConnectwiseAgreementAdditions a WHERE a.agreementId = :agreementId " +
        "AND a.productId IN (SELECT p.id FROM ConnectwiseProductFindResult p " +
        "WHERE LOWER(p.subCategory) LIKE LOWER('%server%') " +
        "OR LOWER(p.subCategory) LIKE LOWER('%workstation%'))")
BigDecimal geAgreementDevicetUnitPrice(@Param("agreementId") Integer agreementId);
但我有一个例外:

2016-05-11 14:58:05.773错误28016---[main]o.h.e.j.s.SqlExceptionHelper:错误:类型“double”不存在 职位:44 线程“main”org.springframework.orm.jpa.JpaSystemException中的异常:org.hibernate.Exception.sqlgrammareException:无法提取结果集;嵌套异常为javax.persistence.PersistenceException:org.hibernate.exception.sqlgrammareexception:无法提取结果集

怎么了? 我使用Postgresql驱动程序

更新 我的实体:

@Entity
@Table(name = "connectwise_agreement_additions")
public class ConnectwiseAgreementAdditions {
@Id
@Column
private Integer id;

@Column(columnDefinition = "DEFAULT false")
private boolean normalize = false;

@Column(name = "agreement_id", columnDefinition = "NUMERIC(18,2)")
private Integer agreementId;

@Column(name = "product_id")
private Integer productId;

@Column(name = "unit_price", columnDefinition = "NUMERIC(18,2)")
private BigDecimal unitPrice;
}

请发布实体ConnectWiseAgreementAdditions的DDL您正在将点后有2位数字的数字价格填充到点后没有数字的大十进制中,这不可能是有效的。请检查您的hibernate方言。PostgreSQL没有
double
类型实际上,它被称为
double-precision
。另外:
Integer agreementId
的列定义为
NUMERIC(18,2)
,这没有什么意义(但可能会起作用),
boolean normalize
应该有类似于
columnDefinition=“boolean DEFAULT false”
的内容,而不仅仅是默认值。您可以使用数据类型float,这是双精度的简写别名。请发布实体ConnectWiseAgreementAdditions的DDL。您正在将点后有2位数字的数字价格填充到点后没有数字的大十进制中,这不可能是有效的。请检查您的hibernate方言。PostgreSQL没有
double
类型实际上,它被称为
double-precision
。另外:
Integer agreementId
的列定义为
NUMERIC(18,2)
,这没有什么意义(但可能会起作用),
boolean normalize
应该有类似于
columnDefinition=“boolean DEFAULT false”
的内容,而不仅仅是默认值。您可以使用数据类型float,这是双精度的简写别名。