W WZP, czy jest jakiś sposób można replikować Hibernate saveOrUpdate behavior,W jaki sposób można zreplikować saveOrUpdate Hibernate w JPA?
saveOrUpdate
public void saveOrUpdate(Object object)
throws HibernateException
Either save(Object) or update(Object) the given instance, depending upon resolution of the unsaved-value checks (see the manual for discussion of unsaved-value checking).
This operation cascades to associated instances if the association is mapped with cascade="save-update".
Parameters:
object - a transient or detached instance containing new or updated state
Throws:
HibernateException
See Also:
save(Object), update(Object)
który zasadniczo sprawdza, czy obiekt już istnieje w bazie danych i albo aktualizacje obiekt jako musi być albo zapisuje nową instancję obiekt.
Wczytanie bezobsługowych plików JPA jest dobre, ale naprawdę brakuje mi tej metody ze stanu hibernacji. Jak doświadczają tego doświadczeni programiści WZP?
Co powiesz na sprawdzenie, czy "klucz podstawowy" jest pusty? –