Spring Framework:根元素类型“beans”的文档类型声明必须以“>”结尾(Spring Framework: The document type declaration for root element type “beans” must end with '>')
这是我的spring.xml
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE beans SYSTEM "http://www.springframework.org/dtd/spring-beans-2.0.dtd" PUBLIC "-//SPRING//DTD BEAN 2.0//EN"> <beans> <bean id="data" class="com.blah.tests.DataProviderClass" /> <bean id="wdcm" class="com.blah.tests.WebDriverCustomMethods"/> </beans>
当我运行我的应用程序测试时,这是我得到的错误:
Caused by: org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 2 in XML document from class path resource [spring.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 82; The document type declaration for root element type "beans" must end with '>'.
我使用Spring 3.0.7
This is my spring.xml
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE beans SYSTEM "http://www.springframework.org/dtd/spring-beans-2.0.dtd" PUBLIC "-//SPRING//DTD BEAN 2.0//EN"> <beans> <bean id="data" class="com.blah.tests.DataProviderClass" /> <bean id="wdcm" class="com.blah.tests.WebDriverCustomMethods"/> </beans>
When I run my application test, this is the error I get:
Caused by: org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 2 in XML document from class path resource [spring.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 82; The document type declaration for root element type "beans" must end with '>'.
Im using Spring 3.0.7
原文:
最满意答案
执行所需操作的一种方法是使用窗口函数:
SELECT * FROM (SELECT et.*, MAX(TIMESTAMP_DATE) OVER (PARTITION BY EMPLOYEE_ID) as MAX_TIMESTAMP_DATE FROM EMPLOYEE_TIMESTAMPS ) et WHERE TIMESTAMP_DATE >= MAX_TIMESTAMP_DATE - 365;
您的版本的问题是使用聚合函数
MAX()
。 首先,查询中没有GROUP BY
。 其次,WHERE
子句中不允许使用这些函数。上述版本中的
MAX()
称为分析函数,因为它具有OVER
子句。One method of doing what you want uses window functions:
SELECT * FROM (SELECT et.*, MAX(TIMESTAMP_DATE) OVER (PARTITION BY EMPLOYEE_ID) as MAX_TIMESTAMP_DATE FROM EMPLOYEE_TIMESTAMPS ) et WHERE TIMESTAMP_DATE >= MAX_TIMESTAMP_DATE - 365;
The problem with your version is the use of the aggregation function
MAX()
. First, there is noGROUP BY
in the query. And, second, these functions are not allowed in theWHERE
clause.The
MAX()
in the above version is called an analytic function, because it has theOVER
clause.
相关问答
更多-
您可以在时间组件上使用TO_DATE() : SELECT datum + ( TO_DATE( zeit, 'HH24:MI:SS' ) - TRUNC( TO_DATE( zeit, 'HH24:MI:SS' ) ) ) FROM table_name 然后为了获得最大值,你可以在这个计算值上使用MAX() ,或者,假设可以使用它们的日期/字母数字排序来比较值(假设时间组件没有超过23:59:59 ),你可以找到最大的第一个: SELECT datum, zeit FROM ( ...
-
获取最新的SQL日期与where(Get newest sql date with where)[2024-01-19]
在select -clause中应用max会将返回的行数更改为1(如果未使用group by ),但不会从DB中选择一个。 max的值是计算结果,DB中的行作为输入。 这就是您的查询不起作用的原因。 解决问题的方法是使用子查询找出最大DateTime并仅选择外部查询中具有此值的行: SELECT DateTime, Value FROM History WHERE TagName = 'G_Z' AND DateTime > '2017-07-10 07:00:00.000' AND DateTim ... -
在Oracle中, DATE数据类型包含年,月,日,时,分和秒组件。 在Java中: java.sql.Date类具有年,月和日组件。 java.sql.Timestamp类具有年,月,日,小时,分和秒组件。 Oracle DATE的正确Java数据类型是java.sql.Timestamp而不是java.sql.Date (可以使用java.sql.Date作为存储过程等的返回值,但会截断时间组件)。 在Oracle中, CURRENT_TIMESTAMP具有数据类型TIMESTAMP WITH TIME ...
-
如果我理解正确,这应该工作: SELECT 'There is no location' FROM Reserve r WHERE EXISTS (SELECT * FROM disponibilidad JOIN estadia ON disponibilidad.identificador_estadia = estadia.identificador ...
-
在Oracle SQL中插入DATE值的格式是什么?(What is the format, for inserting DATE values in Oracle SQL?)[2023-09-20]
默认日期格式是会话的nls_date_format指定的任何格式。 你永远不应该编写依赖于会话的nls_date_format代码,因为这取决于用户的偏好,他们的国家和地区等等。你应该使用显式转换和/或日期文字(日期'yyyy-mm- dd')在您的代码中,而不是依赖于隐式转换。 如果您关心返回的字符串格式,则需要在to_char调用中提供明确的格式掩码。 看来您的会话的nls_date_format是DD-MON-RR ,这是英语安装的常用默认设置。 其他人的默认值可能是YYYY-MON-DD 。 其他人 ... -
sql oracle更新日期(sql oracle update date)[2023-08-22]
您可以使用Oracle的to_date函数将字符串转换为日期: update table1 set "date" = to_date(date_txt, 'MM/DD/YYYY HH:MI:ss AM') 看它在SQL Fiddle工作。 You can use Oracle's to_date function to convert a string to a date: update table1 set "date" = to_date(date_txt, 'MM/DD/YYYY HH:MI:ss ... -
Oracle:如何使用详细信息表中的最新行更新master?(Oracle: How to update master with newest row from detail table?)[2023-08-12]
正如大多数人所说:由于您的数据模型,您遇到了很大问题。 为这个模型编写的大多数代码将比它需要的困难得多。 我已经通过向上和向下的投票以及一些评论中说过,但它不能说得够。 如果您继续沿着自己的方向前进,那么下面的代码将演示需要完成的工作。 希望它吓到你了:-) 样本表: SQL> create table vehicles (id,registrationnumber,lastallocationusername,lastallocationdate,lastallocationid) 2 as 3 ... -
从您发布的查询中,我认为这就是您所追求的: SELECT TRUNC(visit_date, 'mm') visit_date, COUNT(CASE WHEN customer_type = '1' THEN 1 END) c1_count, COUNT(CASE WHEN customer_type = '2' THEN 1 END) c2_count, COUNT(CASE WHEN start_date < TRUNC(visit_date, 'mm') A ...
-
Oracle SQL:选择具有多列之间最新日期的单行(Oracle SQL: Selecting a single row with the latest date between multiple columns)[2023-03-29]
我认为你想要的结构是这样的: select id from (SELECT ID FROM EXAMPLE_TABLE order by GREATEST(CREATE_DATE, UPDATE_DATE) desc ) where rownum = 1 但是,我想其中一个日期可能为NULL。 如果是这样: select id from (SELECT ID FROM EXAMPLE_TABLE order by coalesce(GREATEST ... -
返回从最新日期ORACLE SQL开始计算的最后365个值(return values within the last 365 counting from newest date ORACLE SQL)[2023-01-03]
执行所需操作的一种方法是使用窗口函数: SELECT * FROM (SELECT et.*, MAX(TIMESTAMP_DATE) OVER (PARTITION BY EMPLOYEE_ID) as MAX_TIMESTAMP_DATE FROM EMPLOYEE_TIMESTAMPS ) et WHERE TIMESTAMP_DATE >= MAX_TIMESTAMP_DATE - 365; 您的版本的问题是使用聚合函数MAX() 。 首先,查询中没 ...