Spring data jpa有个错误,谁能帮我看看 springjpagetPropertyNoSuchMethodError 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 说是类,你写为private类型的了。改为public List<Person> findByBirthdayGreaterThan(Date date)修改成List<Person> findByBirthdayGreaterThan(Date birthday) 试试 http://bbs.csdn.net/topics/380226460看下这个吧。貌似是一个问题。 jpa dao接口方法命名需要符合一定的规范,看看官方文档 改了,改成最简单的“List<Person> findByName(String name);”没用是不是配置文件<?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:context="http://www.springframework.org/schema/context" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:p="http://www.springframework.org/schema/p" xmlns:cache="http://www.springframework.org/schema/cache" xmlns:jpa="http://www.springframework.org/schema/data/jpa" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache-3.1.xsd http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa.xsd"> <context:annotation-config /> <context:component-scan base-package="cn.luxh.app"/> <!-- 定义实体管理器工厂 --> <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"> <property name="persistenceUnitName" value="simple"/> </bean> <!-- 配置事务管理器 --> <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"> <property name="entityManagerFactory" ref="entityManagerFactory" /> </bean> <!-- 启用 annotation事务--> <tx:annotation-driven transaction-manager="transactionManager"/> <!-- 配置Spring Data JPA扫描目录--> <jpa:repositories base-package="cn.luxh.app.repository"/> </beans> <jpa:repositories base-package="cn.luxh.app.repository"/>-><jpa:repositories base-package="cn.luxh.app.repository" transaction-manager-ref="transactionManager" entity-manager-factory-ref="entityManagerFactory" />在试试 使用spring data JPA没有遇到这样的错误。不知为何。不过看楼主使用的版本跟我不一样就是。 我也参考了http://www.cnblogs.com/luxh/archive/2012/08/31/2665421.html,问题和楼主的一样,不能再Dao层自定义方法(已经按Jpa规范定义了,甚至@query也用过),定义就报错,请问楼主最后是如何解决的? JAVA字符串比较很奇怪 jsp if语句的用法 java 读取含有分隔符的TXT文件 如何用javaMail发送电子邮件 请问有没有ANT构建文件编辑器? 有没有比较新的Spring,hibernate,struts的面试笔试题啊 hibernate 3.2 + mysql中文乱码问题 wtp2.0开发ejb的问题 【有趣的问题】关于Tomcat的 关于 watool 的问题 面试中经常问的问题:项目中遇到哪些难题和困难,你是怎么解决的?求个清晰的思路,最好有个例子 团队开发,大家需要用相同版本的myeclipse吗?
修改成
List<Person> findByBirthdayGreaterThan(Date birthday) 试试
看下这个吧。貌似是一个问题。
是不是配置文件<?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:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:cache="http://www.springframework.org/schema/cache"
xmlns:jpa="http://www.springframework.org/schema/data/jpa"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.1.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
http://www.springframework.org/schema/cache
http://www.springframework.org/schema/cache/spring-cache-3.1.xsd
http://www.springframework.org/schema/data/jpa
http://www.springframework.org/schema/data/jpa/spring-jpa.xsd">
<context:annotation-config />
<context:component-scan base-package="cn.luxh.app"/>
<!-- 定义实体管理器工厂 -->
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="persistenceUnitName" value="simple"/>
</bean>
<!-- 配置事务管理器 -->
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory" />
</bean>
<!-- 启用 annotation事务-->
<tx:annotation-driven transaction-manager="transactionManager"/>
<!-- 配置Spring Data JPA扫描目录-->
<jpa:repositories base-package="cn.luxh.app.repository"/>
</beans>
->
<jpa:repositories base-package="cn.luxh.app.repository"
transaction-manager-ref="transactionManager"
entity-manager-factory-ref="entityManagerFactory" />
在试试