From: Roland Haeder Date: Fri, 11 Mar 2016 21:02:33 +0000 (+0100) Subject: Some cascade/fetch cleanups: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=00498185e1656dd0d4c2b10e0edbe6ac9161d71f;p=jcontacts-core.git Some cascade/fetch cleanups: - CascadeType.MERGE is basicly an UPDATE statement, it needs to be REFRESH (from database to local entity object) - Fetch strategy EAGER is default, no need to specify it - updated jar(s) --- diff --git a/src/org/mxchange/jcontacts/contact/UserContact.java b/src/org/mxchange/jcontacts/contact/UserContact.java index 64087c3..b1daf29 100644 --- a/src/org/mxchange/jcontacts/contact/UserContact.java +++ b/src/org/mxchange/jcontacts/contact/UserContact.java @@ -26,7 +26,6 @@ import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.EnumType; import javax.persistence.Enumerated; -import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; @@ -107,7 +106,7 @@ public class UserContact implements Contact, Comparable { * Country code */ @JoinColumn (name = "contact_country_id", nullable = false, referencedColumnName = "country_id") - @OneToOne (targetEntity = CountryData.class, cascade = CascadeType.MERGE, optional = false, fetch = FetchType.EAGER) + @OneToOne (targetEntity = CountryData.class, cascade = CascadeType.REFRESH, optional = false) private Country contactCountry; /**