]> git.mxchange.org Git - jcontacts-core.git/commitdiff
Some cascade/fetch cleanups:
authorRoland Haeder <roland@mxchange.org>
Fri, 11 Mar 2016 21:02:33 +0000 (22:02 +0100)
committerRoland Haeder <roland@mxchange.org>
Fri, 11 Mar 2016 21:02:33 +0000 (22:02 +0100)
- 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

index 64087c3fea52363514bd6c748ef38c0da04d45d3..b1daf29b463fe388f1b192694e929bd5e749fee3 100644 (file)
@@ -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<Contact> {
         * 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;
 
        /**