- This topic has 4 replies, 2 voices, and was last updated 11 years, 1 month ago by support-tony.
-
AuthorPosts
-
cidy.longMemberThis 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?
cidy.longMemberselect 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’
support-tonyKeymastercidy.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.
cidy.longMemberHi, Tony
Happy new year! I had fixed it by have an other work around. No worry.
Cidy
support-tonyKeymasterOK, Cidy. Thanks for getting back to us, and a Happy New Year to you, too!
-
AuthorPosts