I want to create an AbstractEntity
class for id
& version
fields, so I don't have to declare those fields & accessors in every entity class. Something like:
public abstract class AbstractEntity {
@Id private Object id;
@Version private Integer version;
public Object getId() { return id; }
(...)
public class User extends AbstractEntity {
private String login;
private String password;
(...)
In JPA, I could annotate AbstractEntity
with @MappedSuperclass
, so it won't generate an AbstractEntity
table on db. How can I achieve the same behavior in OrientDB Object Database API? I don't want an AbstractEntity
class in my database.
Today there isn't an annotation for that but you've to declare the class as "Abstract" in the schema. Example:
OClass abstractEntity = db.getMetadata().getSchema().createClass("AbstractEntity");
abstractEntity.setAbstract( true );