facebook

MappingException

  1. MyEclipse Archived
  2.  > 
  3. Database Tools (DB Explorer, Hibernate, etc.)
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #294043 Reply

    sangawar
    Member

    Hello,

    I am using myeclipse 7.0. My idea is to use annotations and created a simply database with
    couple of tables. I was able to generate the annotated code etc. Wrote a tester and
    getting this exception. I created everything without using packages etc. It generated the .class files, .xml files etc correctly. The code has the annotation. In the main, I even did
    the AnnotationConfiguration stuff. I simply not in a position to figure out why I am
    getting this. It looks to me that it is not Hibernate 3.2 and it looks like it is the old way
    of doing things (No Annotations) with tons of .xml files etc. Please help…

    Thanks

    Pramod

    Exception in thread “main” org.hibernate.MappingException: Unknown entity: Person
    at org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:550)
    at org.hibernate.impl.SessionImpl.getEntityPersister(SessionImpl.java:1338)
    at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:98)
    at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:187)

    #294112 Reply

    Brian Fernandes
    Moderator

    Pramod,

    1) Is the Person class listed in your hibernate.cfg.xml file? You should have a <mapping class = “Person”/> element in there.

    2) If the above is true and you’re still having problems, I would recommend generating into a fixed package as importing classes from default packages tend to sometimes cause problems.

    Hope this helps.

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: MappingException

You must be logged in to post in the forum log in