facebook

org.hibernate.hql.ast.QuerySyntaxException:table not mapped

  1. MyEclipse IDE
  2.  > 
  3. Spring Development
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #345619 Reply

    cidy.long
    Member

    This is probably very common issue with Myeclipse for Spring 2014 generated code modification. I had generated set of Scaffolding CRUD simple application. for normal list and view and edit, it is fine. but when I went to next step to put some logic between the generated code, seems not really working well.

    I am trying build a contract class have some information from customer and some from storage unit and some from code table. I have a HQL statement as:

    select concat(s.unit_title,s.unit_id), concat(l.price_week,’/week’) from storageUnits s inner join ListPrice l on s.unit_title=l.unit_title where s.unit_status=’Available’

    in my createQuery statement to return a set of available unit list to generate a drop down list let customer to pick. I did the function in service layer and implement it in serviceImpl class, and then inject it to Controller class. when I trigger it from UI, the error message pop up shows as:

    Request processing failed; nested exception is java.lang.IllegalArgumentException: org.hibernate.hql.ast.QuerySyntaxException: storageUnits is not mapped [select concat(s.unit_title,s.unit_id), concat(l.price_week,’/week’) from storageUnits s inner join ListPrice l where s.unit_title=l.unit_title and s.unit_status=’Available’]

    seam hibernate is looking for a hibernate.nbm.xml for execute such HQL? I tried to generate some map config from reverse engineering, seem it is not same with eclipse.

    Any better way to execute SQL instead of HQL in myeclips spring MVC?

    #345620 Reply

    cidy.long
    Member

    select concat(s.unit_title,s.unit_id), concat(‘$’,l.price_week,’/week’) from storageUnits s inner join ListPrice l where s.unit_title=l.unit_title and s.unit_status=’Available’

    #345644 Reply

    support-tony
    Keymaster

    cidy.long,

    Do you have a class named “storageUnits” that is mapped via JPA annotations, in the same way as the generated classes are? It may be just a case of needing to capitalize the first character of the name, that is, “StorageUnits” as classes usually start with an uppercase letter. The class is mapped to a table via annotations. Take a look at the generated classes for examples.

    Please let us know if this helps.

    #345648 Reply

    cidy.long
    Member

    Hi, Tony

    Happy new year! I had fixed it by have an other work around. No worry.

    Cidy

    #345668 Reply

    support-tony
    Keymaster

    OK, Cidy. Thanks for getting back to us, and a Happy New Year to you, too!

Viewing 5 posts - 1 through 5 (of 5 total)
Reply To: org.hibernate.hql.ast.QuerySyntaxException:table not mapped

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