10

is there a way to make the DB create the ID property in an automatic way?

I want to generate something that looks like this:

Entity entity = schema.addEntity("MyEntity");
entity.addIdProperty().autoIncrement().primaryKey();

is this possible?

thepoosh
  • 12,497
  • 15
  • 73
  • 132

1 Answers1

11

Yes, that looks just fine. Depending on your needs entity.addIdProperty() or entity.addIdProperty().autoIncrement() should be fine. addIdProperty will already call primaryKey().

Markus Junginger
  • 6,950
  • 31
  • 52