我想运行一个简单的使用JPA和Hibernate的dataImport类。JPA休眠Maven测试 - >未知类
如果我跑我的课,我总是有以下错误:
Exception in thread "main" java.lang.IllegalArgumentException: Unknown entity: ch.itartis.relman.entities.code.ReferenceCode
at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:675)
at ch.itartis.relman.service.test.dataimport.DataImport.doSave(DataImport.java:111)
at ch.itartis.relman.service.test.dataimport.DataImport.main(DataImport.java:43)
我的班级位于src /测试/ JAVA /文件夹,我src/test下一个服务-config.xml中/ resources /,并且在src/test/resources/META-INF /中也有一个persistence.xml。
如果我在src/main/java/...文件夹中运行该类,它将起作用。但是如果我想在src/test/java /中有这个类,它不会。
我在做什么错?
非常感谢!
'跑我的班'是什么意思?你如何运行它?问题可能是/ src/test/java不在你的类路径中。 – Simeon 2011-06-10 13:33:39
查看http://stackoverflow.com/questions/4885836/no-autodetection-of-jpa-entities-in-maven-verify – axtavt 2011-06-10 14:02:21