Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to extend JPA entity NamedQueries?

 
Ralf Butler
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • 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
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic