Search code examples
orientdb

OrientDB: add metadata to a class


I need to add metadata to a vertex class. I want to store the canonical name of the java class in the Vertex class definition as a metadata so later I could ask for it to instantiate and hydrate an object. Are there any way to do that?


Solution

  • You can define CUSTOM metadata by using ALTER CLASS command. Example.

    ALTER CLASS Post CUSTOM javaClass="com.my.Post"
    

    So you can retrieve that custom property through API or SQL.

    For more information look at the official documentation about it: http://orientdb.com/docs/last/SQL-Alter-Class.html.