Hibernate's saveOrUpdate() v. JPA's merge()

If I use the deprecated saveOrUpdate() in the dao layer, the method returns an object with an assigned id. If I use merge() , on the other hand, it returns an object with an id of zero (entities are saved correctly in the database). Why?

2023-03-21_08-05-22