I am using OrientDB with Java via its Document API. I have a simple Class called
OSchema schema = db.getMetadata().getSchema();
OClass itemsClass = schema.createClass("items");
CREATE INDEX items.ID ON items (ID) UNIQUE
ODocument doc = new ODocument("items")
OrientDB doesn't support serial (we've an issue for that), so you can manage your own counter in this way (example using SQL):
create class counter insert into counter set name='mycounter', value=0
And then every time you need a new number you can do:
update counter incr value = 1 where name = 'mycounter'
This works in a SQL batch in this way:
begin let $counter = update counter incr value = 1 where name = 'mycounter' return after insert into items set id = $counter.value, qty = 10, price = 1000 commit
By using Java you can make the same: create singleton class "Counters" that everytime increment the document value and save it.