Page 2 of 2 FirstFirst 12
Results 11 to 14 of 14

Thread: Object not mapped problem

  1. #11

    Default Thanks for the answer

    madhav,

    Thanks a lot for the answer, I had the same issue and tried to solve for 2 hours. It's just using the class name not the table name in the query.

    Cheers,



    Quote Originally Posted by madhav View Post
    I solved the problem I encountered using exact 'case' of the persistent class.

    I had a Message class that is getting persisted to MESSAGES table.
    My query read like:
    Code:
    session.createQuery("from message m order by m.text asc").list()
    That did not work.

    Changing to
    Code:
    session.createQuery("from Message m order by m.text asc").list()
    worked !!!

    Environment: Hibernate 3.2, Spring 2, Hibernate Annotations, Ejb3 persistence jar

    -Madhav

  2. #12
    Join Date
    Nov 2010
    Posts
    1

    Talking Mapping Problem solved !!!!

    Hi guys I also folowed the madhav suggestion and the mapping issue was solved changing the query pointing to the class name instead to the table name.

    My table is called "t_user" and it is mapped to the "User" class

    So I changed my query from: "SELECT someColumn FROM t_user ...."
    to: "SELECT someColumn FROM User .... "

    It works with XML or annotations !!!!
    Last edited by devale; Nov 1st, 2010 at 02:35 PM.

  3. #13

    Default

    Quote Originally Posted by Wordman View Post
    I also had the "not mapped" problem. After tracing through the Hibernate Annotation code, I eventually figured out that I was using the wrong import in the class I was trying to map. The correct import is:

    import javax.persistence.Entity;

    When I was writing the file in Eclipse, I must have chosen "import org.hibernate.annotations.Entity;" instead, which is wrong.
    I solved the problem I encountered using exact 'case' of the persistent class.

    I had a Message class that is getting persisted to MESSAGES table.

    ___________________
    watch movies online
    Last edited by daviidwilson; Nov 1st, 2010 at 06:40 PM.

  4. #14
    Join Date
    Mar 2012
    Posts
    1

    Default

    Hi Johan,
    You need to keep your table name in (XXX.hbm.xml) file and the entityname in the query SAME. check that

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •