学习 Hibernate-JPA 出错

阅读更多
我想学一下怎么用 Hibernate 实现的 JPA,结果报错:

...
Caused by: java.lang.NoSuchMethodError: 
org.hibernate.cfg.AnnotationConfiguration.setProperty(Ljava/lang/String;
    Ljava/lang/String;)Lorg/hibernate/cfg/AnnotationConfiguration;
	at org.hibernate.ejb.Ejb3Configuration.setProperty(Ejb3Configuration.java:535)
	at org.hibernate.ejb.Ejb3Configuration.setDataSource(Ejb3Configuration.java:149)
	at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:399)
	at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory
(HibernatePersistence.java:131)
	at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntity
ManagerFactory(LocalContainerEntityManagerFactoryBean.java:224)
	at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet
(AbstractEntityManagerFactoryBean.java:291)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1368)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
.initializeBean(AbstractAutowireCapableBeanFactory.java:1334)
	... 39 more


相关类库(貌似没什么冲突啊):
hibernate-annotations-3.4.0.GA
hibernate-core-3.3.1.GA
hibernate-entitymanager-3.4.0.GA

相关 jar 包:
antlr-2.7.6.jar
cglib.jar
commons-beanutils.jar
commons-chain-1.1.jar
commons-collections-3.1.jar
commons-configuration-1.2.jar
commons-dbcp-1.2.1.jar
commons-digester-1.7.jar
commons-fileupload-1.2.1.jar
commons-io-1.3.2.jar
commons-lang-2.4.jar
commons-logging-api-1.1.jar
commons-logging.jar
commons-pool-1.2.jar
commons-validator-1.3.0.jar
dom4j-1.6.1.jar
ejb3-persistence.jar
freemarker.jar
hibernate-annotations.jar
hibernate-commons-annotations.jar
hibernate-core.jar
hibernate-entitymanager.jar
javassist-3.4.GA.jar
jta-1.1.jar
log4j-1.2.13.jar
mysql-connector-java-5.1.7-bin.jar
ognl.jar
slf4j-api-1.5.6.jar
slf4j-simple-1.5.6.jar
spring-webmvc.jar
spring.jar
struts2-core.jar
struts2-spring-plugin-2.1.6.jar
xwork.jar

applicationContext.xml


    
    
        
        
        
        
    
    
        
        
        
    
    
        
    

    
    
        
    

    
    


persistence.xml

    
        org.hibernate.ejb.HibernatePersistence
        
            
            
        
    

你可能感兴趣的:(Hibernate,JPA,Spring,Java,EJB)