Hibernate保持检测
org.hibernate.QueryParameterException: could not locate named parameter [name]
Run Code Online (Sandbox Code Playgroud)
即使它存在.这是我的hql
Query query = sess().createQuery("from UserProfile where firstName LIKE '%:name%'").setParameter("name", name);
Run Code Online (Sandbox Code Playgroud)
为什么hibernate不断抛出异常?即使参数存在?
什么是getSource?它返回了什么?
什么是getActionCommand()以及它返回什么?
我对这两个人之间的困惑可以让任何人给予我或将它们区分给我吗?在UI中使用getSource和getActionCommand()有什么用?特别是TextField还是JTextField?
假设我有这个给定的数据
{
"name" : "ABC",
"favorite_cars" : [ "ferrari","toyota" ]
}, {
"name" : "ABC",
"favorite_cars" : [ "ferrari","toyota" ]
}, {
"name" : "GEORGE",
"favorite_cars" : [ "honda","Hyundae" ]
}
Run Code Online (Sandbox Code Playgroud)
每当我在搜索最喜欢的汽车是丰田的人时查询这些数据,它就会返回这些数据
{
"name" : "ABC",
"favorite_cars" : [ "ferrari","toyota" ]
}, {
"name" : "ABC",
"favorite_cars" : [ "ferrari","toyota" ]
}
Run Code Online (Sandbox Code Playgroud)
结果是两个名称为ABC的记录.如何仅选择不同的文档?我想得到的结果只是这个
{
"name" : "ABC",
"favorite_cars" : [ "ferrari","toyota" ]
}
Run Code Online (Sandbox Code Playgroud)
这是我的查询
{
"fuzzy_like_this_field" : {
"favorite_cars" : {
"like_text" : "toyota",
"max_query_terms" : 12
}
}
} …Run Code Online (Sandbox Code Playgroud) java aggregate nosql elasticsearch spring-data-elasticsearch
当我创建一个弹簧项目时,我总是遇到XLMNS的问题.什么是XMLNS?实际上这些是什么?
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd"
Run Code Online (Sandbox Code Playgroud)
我在哪里可以获得这些参考?(xmlns的资源:xsi和xsi:schemeLocation.)是否有这些在线手册?我似乎无法找到它们.
注意 当我说引用时,我指的是适合它们的URL
更新
我在哪里可以看到Spring bean,Spring Transactions,Spring MVC等的XML命名空间?及其架构位置?
我正在使用Spring Data JPA.
我是这样的实体
public class A {
@CollectionTable(name = "B_ITEMS", joinColumns = @JoinColumn(name = "B_ID"))
@ElementCollection
private List<B> bs;
}
Run Code Online (Sandbox Code Playgroud)
和嵌入式课程
@Embeddable
public class B {
private String prop1
private String prop2
private String prop3
}
Run Code Online (Sandbox Code Playgroud)
如何使用内容@ElementCollection B搜索实体A?
这是我的存储库Spring Data JPA Repositry
public interface ARepo extends PagingAndSortingRepository<Clinic, Long> {
}
Run Code Online (Sandbox Code Playgroud)
什么查询方法名称适用于我的用例?
我试图在我的JSP中包含一个HTML文件,但是eclipse显示了这个错误
包含的文件
<%@include file="includes/head.html" %>
Run Code Online (Sandbox Code Playgroud)
而错误
Processing instruction not closed
Run Code Online (Sandbox Code Playgroud)
这只是简单的JSP
<%@include file = "includes/head.html" %>
<form action = "#" method = "POST">
Username: <input type = "text" name = "username"><br/>
Password: <input type = "password" name = "password"><br/>
</form>
</body>
</html>
Run Code Online (Sandbox Code Playgroud) 这是我的Web.xml
dispatcherServlet org.springframework.web.servlet.DispatcherServlet contextConfigLocation /WEB-INF/spring/servlet-context.xml 1
<servlet>
<servlet-name>dispatcherServlet</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/spring/servlet-context.xml
</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dispatcherServlet</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
Run Code Online (Sandbox Code Playgroud)
我的servlet-context.xml
<context:component-scan base-package="com.springexample.controller.impl" />
<mvc:annotation-driven />
<bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix">
<value>/WEB-INF/views/</value>
</property>
<property name="suffix">
<value>.jsp</value>
</property>
</bean>
Run Code Online (Sandbox Code Playgroud)
最后是Handler类.它位于com.springexample.controller.impl下
@Controller
public class IndexControllerImpl implements IndexController {
@RequestMapping("/")
public String index() {
return "index";
}
}
Run Code Online (Sandbox Code Playgroud)
但是要去 localhost:8080/projectname/
它返回404错误.
Jul 27, 2013 8:18:31 PM org.springframework.web.servlet.DispatcherServlet noHandlerFound
WARNING: No mapping found for HTTP request with …Run Code Online (Sandbox Code Playgroud) 这是我的messageResource声明
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd">
<!-- Auto-detect controllers in this package -->
<context:component-scan base-package="levelup.world.web" />
<!-- Prepend /WEB-INF/jsp/ and append .jsp to the view name -->
<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/jsp/" />
<property name="suffix" value=".jsp" />
</bean>
<!-- Access resource bundles with the specified basename -->
<bean id="messageSource"
class="org.springframework.context.support.ReloadableResourceBundleMessageSource"
p:basename="/WEB-INF/messages/" />
</beans>
Run Code Online (Sandbox Code Playgroud)
当我运行我的应用程序时,会出现此错误
No message found under code 'country.plural' for locale 'fil_PH'
Run Code Online (Sandbox Code Playgroud)
现在在web-inf里面的我的消息文件夹里面,我有以下消息属性
messages_en.properties
messages_fr.properties
messages.properties
Run Code Online (Sandbox Code Playgroud)
我在这里失踪了什么?
我有这个数据模型
public class CustomerModel{
@Column
@Type(type="org.joda.time.contrib.hibernate.PersistentDateTime")
private DateTime membershipDate;
//Other properties and getters
}
Run Code Online (Sandbox Code Playgroud)
以下回购
public interface CustomerRepo extends Repository<CustomerModel, Long>{}
Run Code Online (Sandbox Code Playgroud)
我想做的是.检索给定日期的所有用户,例如(2013年8月1日加入的成员)但问题是我的数据库上的membershipDate有时间.如何忽略时间并检索给定日期的所有用户?