Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll

- 2x 2x
- 1.75x 1.75x
- 1.5x 1.5x
- 1.25x 1.25x
- 1.1x 1.1x
- 1x 1x
- 0.75x 0.75x
- 0.5x 0.5x
Moving on through the CRUD operations, you have yet to cover updating and deleting. In this lesson, you again use the Hibernate `Session` to perform these operations.
Note:
The .update()
and .delete()
methods in Hibernate are deprecated. They still work as expected, though you may see warnings in your IDE. It is now recommended to use .merge()
for updating detached entities and .remove()
for deleting entities.
If you previously utilized .persist()
in place of the deprecated .save()
, note that .persist()
does not return the entity's ID. To retrieve the ID after persisting, simply access it using the getter (e.g., entity.getId()
) after the transaction is committed, as the entity becomes managed and its ID is automatically generated.
Hibernate Resources
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up-
Henry Lin
11,636 Points0 Answers
-
Andrey Serebryanskiy
5,756 Points1 Answer
-
Ricardo Sala
16,212 Points2 Answers
-
Ted Dunn
43,783 Points2 Answers
-
Chitra Sharathchandra
6,188 Points2 Answers
-
PLUS
Jeff Nice
Courses Plus Student 50 Points6 Answers
View all discussions for this video
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up