title: Multi-Level inheritance and Versioning issue in SQLAlchemy
body: <p>I seem to be having an issue when calling up the history of a versioned SQLAlchemy class.
  I have the following inheritance structure setup:</p>
  
  <pre><code>Node(Versioned, Base)
  Specimen(Node)
  Animal(Specimen)
  </code></pre>
  
  <p>If I attempt to fetch the animal history using the query generated by :</p>
  
  <pre><code>AnimalHistory = self.__history_mapper__.class_
  q = object_session(self).query(AnimalHistory).filter(AnimalHistory.id == self.id).order_by(AnimalHistory.version.desc())
  
  logger.debug(q)
  </code></pre>
  
  <p>I get the following query:</p>
  
  <pre><code>SELECT bla bla #trimmed for brevity                                                                                                                                                                    FROM node_history 
  JOIN specimen_history ON node_history.id = specimen_history.id AND node_history.version = specimen_history.version 
  JOIN animal_history ON specimen_history.id = animal_history.id 
  WHERE animal_history.id = 28 
  ORDER BY animal_history.version DESC
  </code></pre>
  
  <p>Basically, I seem to be missing the appropriate "AND" statement on the animal_history JOIN.
  Because of this, I get an unwanted cartesian product between animal and (specimen, node)</p>
  
  <p>Could anyone point out the modification needed inside history_meta.py in order to fix this ?</p>
  
  <p>Thanks !!</p>