• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to extend JPA entity NamedQueries?

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there,

How do I extend a JPA entity in regard to its NamedQueries. Following doesn't work:


I then invoke the whole thing via:


I receive the error message that singleResult is empty.

Help is much appreciated.
Thanks
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK. These two are just nitpicks and you don't have to change it.

1) I put my Named queries above the @Entity because Named Queries, while you have them in a class are not scoped to the class but to the SessionFactory.
2) What is with all those front underscores. "_". This is Java we don't use underscores in variable names. ;)

So do you have show_sql on so that you can see the query that gets run? Then check to see if the query itself actually returns records from the database. The error that shows is saying that the query is running except that the result set has no records in it.

Mark
reply
    Bookmark Topic Watch Topic
  • New Topic