title: How to I query for the inherited class type in Java/MySQL?
body: <p>Item is an abstract class, which is implemented by both the Material and Product classes.</p>
  
  <p>The Distribution entity has an attribute "item" which is of an Item type. How do I check if the "item" is of the Product type? Right now I'm using this but it doesn't seem to be optimal.</p>
  
  <pre><code>"SELECT d FROM " + Distribution.class.getName() + " d, " + Product.class.getName() + " p WHERE d.item = p"
  </code></pre>