user1392203
user1392203

Reputation: 309

How does play.db.jpa.Model class provide automatically the auto generated Long id field

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

Answers (1)

Codemwnci
Codemwnci

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

Related Questions