开发者

hibernate persistence

I work with hibernate I create hibernate.cgf.xml and the mapping file. I create a class java for the entity and the hibernateUtil.java and when i run the test main it generate this:

Exception in thread "main" net.sf.hibernate.MappingException: No persister for: fr.hibernate.projet.model.Employe
    at net.sf.hibernate.impl.SessionFactoryImpl.getPersister(SessionFactoryImpl.java:347)
    at net.sf.hibernate.impl.SessionImpl.getClassPersister(SessionImpl.java:2690)
    at net.sf.hibernate.impl.SessionImpl.getPersister(SessionImpl.java:2697)
    at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl开发者_JAVA百科.java:763)
    at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:738)
    at fr.hibernate.projet.test.Test.main(Test.java:32)

The database is still empty.


"no persiter" usually means that there is no mapping definition for the given type. Did you load the mapping definitions in your program?

EDIT: You may have an issue with the configuration file. It must be on a path where it can be found. Google.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜