J888
J888

Reputation: 1964

How to use insert and update in hibernate?

How to use the insert and update in hibernate to change avoid updating a class.

Upvotes: 0

Views: 99

Answers (1)

PSR
PSR

Reputation: 40348

We can use both types.But in the second case retrieval is easy.You can get the object simply. But in the first case you need to pass the id to database to get the object.

Otherwise you can use both options one for insert and one for retrieval .When inserting use

developerObj.setDevID(12);

and set insertable = false and updatable = false

When you retrieve use project.developer.devId

Upvotes: 1

Related Questions