I just started learning server/database stuff on Java, and I was wondering what the piece of code @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
means/does. I am using Google's App Engine
Thanks!
I just started learning server/database stuff on Java, and I was wondering what the piece of code @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
means/does. I am using Google's App Engine
Thanks!
That's a Java annotation defining the strategy the annotated entity will use to be persisted.
It means, that, for instance if you have a class Employee
, it will be persistent, and the way its primary key will be generated, will be with a mechanism called IDENTITY
which automatically creates the next value for you.
All this part of an API called Java Persistence API