From 00498185e1656dd0d4c2b10e0edbe6ac9161d71f Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Fri, 11 Mar 2016 22:02:33 +0100 Subject: [PATCH] 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) --- src/org/mxchange/jcontacts/contact/UserContact.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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; /** -- 2.39.5