Saving all members from the list with jpa in database, can we ignore the data which is already in database

Viewed 26

Assume that we have a list of user details, and we want to add it to the database, but I want that if there are some users in the list that could have already been added but some aren't. So is there any way we can do it with

dao.saveAll(list);

without first checking in db for data

1 Answers

If the entity user has an id, JPA will perform an update on the record. if id is null or id doesn't exit the database, JPA will create on the record.

Related