Reputation: 309
I was asked to make some changes (and updates) in a database that is used by a web application using play.db.jpa.Model. I was wondering how does play.db.jpa.Model class provide automatically the auto generated Long id field I want to insert data independent the web application
Upvotes: 0
Views: 439
Reputation: 54924
If you take a look at the class for Model, you will see this snippet of code
@Id
@GeneratedValue
public Long id;
The two annotations are responsible for generation of the autonumber. For more detail of how this works, check out the hibernate docs for identifier properties.
Upvotes: 3