title: OrientDB with Spring polymorphism
body: <p>I am trying the following thing in <strong>Java with OrientDB</strong> with Spring using spring-data-gremlin (which uses <strong>gremlin API</strong>).</p>
  
  <pre><code>class Audit extends BaseEntity{
  
   @oneToMany
   private BaseEntity auditOn;
  }
  
  Class Taxonomy extends BaseEntity {
  
  }
  
  Class BaseEntity {
  }
  </code></pre>
  
  <p>Now I am trying to create a link between Audit via auditOn to Taxonomy and receiving the following exception in <code>Orient DB 2.2.3</code> where it is working fine in <code>Orient DB 2.2.2.</code></p>
  
  <pre><code>Caused by: com.orientechnologies.orient.core.exception.OValidationException: The field 'auditOn.in' has been declared as LINK of type 'BaseEntity' but the value is the document #154:1 of class 'Taxonomy'
      at com.orientechnologies.orient.core.record.impl.ODocument.validateLink(ODocument.java:484)
      at com.orientechnologies.orient.core.record.impl.ODocument.validateField(ODocument.java:275)
      at com.orientechnologies.orient.core.record.impl.ODocument.validate(ODocument.java:1953)
      at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.save(ODatabaseDocumentTx.java:2259)
      at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.save(ODatabaseDocumentTx.java:118)
      at com.orientechnologies.orient.core.record.impl.ODocument.save(ODocument.java:1727)
      at com.orientechnologies.orient.core.record.impl.ODocument.save(ODocument.java:1718)
      at com.orientechnologies.orient.core.record.impl.ODocument.save(ODocument.java:76)
      at com.orientechnologies.orient.core.db.record.ridbag.embedded.OEmbeddedRidBag.serialize(OEmbeddedRidBag.java:371)
      at com.orientechnologies.orient.core.db.record.ridbag.ORidBag.toStream(ORidBag.java:274)
      at com.orientechnologies.orient.core.serialization.serializer.record.binary.ORecordSerializerBinaryV0.writeSingleValue(ORecordSerializerBinaryV0.java:581)
      at com.orientechnologies.orient.core.serialization.serializer.record.binary.ORecordSerializerBinaryV0.serialize(ORecordSerializerBinaryV0.java:261)
      at com.orientechnologies.orient.core.serialization.serializer.record.binary.ORecordSerializerBinary.toStream(ORecordSerializerBinary.java:105)
      at com.orientechnologies.orient.core.record.impl.ODocument.toStream(ODocument.java:2100)
      at com.orientechnologies.orient.core.record.impl.ODocument.toStream(ODocument.java:695)
      at com.orientechnologies.orient.client.remote.OStorageRemote.commitEntry(OStorageRemote.java:1998)
      ... 106 more
  </code></pre>