java.lang.NoClassDefFoundError: javax/persistence/Cacheable

我用annotations做hibernate操作時報這個錯誤:
Exception in thread “main” java.lang.NoClassDefFoundError: javax/persistence/Cacheable
at org.hibernate.cfg.AnnotationBinder.determineCacheSettings(AnnotationBinder.java:953)
at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:596)
at org.hibernate.cfg.AnnotationConfiguration.processArtifactsOfType(AnnotationConfiguration.java:636)
at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:359)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1377)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:954)
at TeacherTest.main(TeacherTest.java:17)

原因及解決辦法:
javax.persistence.Cacheable 是 JPA 2.0 規範中的東西!
需要加入hibernate-distribution-3.5.6-Final\lib\jpa目錄下的hibernate-jpa-2.0-api-1.0.0.Final.jar
到path中

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章