Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Stop retrieving subclass instances ?

 
david zhang
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a named query as follows:

@NamedQuery (name="emp", query="from Employee")

Employee has subclasses such PartTimeEmployee.

When I run the above query, the results contain instances from PartTimeEmployee table.

How can I retrieve only instances from Employee, not PartTimeEmployee?

I am new in JPA. Thanks for help!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!