From 50292bd40f805d9515b53201e18be121bb8a4702 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Mon, 9 May 2016 12:00:54 +0200 Subject: [PATCH] No, was not working ... :-( --- .../model/addressbook/UserAddressbook.java | 4 +++- .../model/addressbook/entry/UserAddressbookEntry.java | 9 ++++++--- .../model/addressbook/shared/AddressbookShare.java | 8 ++++++-- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/org/mxchange/jaddressbookcore/model/addressbook/UserAddressbook.java b/src/org/mxchange/jaddressbookcore/model/addressbook/UserAddressbook.java index d765b2e..6057c66 100644 --- a/src/org/mxchange/jaddressbookcore/model/addressbook/UserAddressbook.java +++ b/src/org/mxchange/jaddressbookcore/model/addressbook/UserAddressbook.java @@ -36,6 +36,7 @@ import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; import org.mxchange.jaddressbookcore.model.addressbook.status.AddressbokStatus; +import org.mxchange.jusercore.model.user.LoginUser; import org.mxchange.jusercore.model.user.User; /** @@ -52,6 +53,7 @@ import org.mxchange.jusercore.model.user.User; @NamedQuery (name = "SearchAddressbookById", query = "SELECT a FROM addressbooks AS a WHERE a.addressbookId = :id") } ) +@SuppressWarnings ("PersistenceUnitPresent") public class UserAddressbook implements Addressbook { /** @@ -108,7 +110,7 @@ public class UserAddressbook implements Addressbook { * Connection to "users" table */ @JoinColumn (name = "addressbook_user_id", nullable = false) - @OneToOne (targetEntity = User.class, cascade = CascadeType.REFRESH, optional = false) + @OneToOne (targetEntity = LoginUser.class, cascade = CascadeType.REFRESH, optional = false) private User addressbookUser; /** diff --git a/src/org/mxchange/jaddressbookcore/model/addressbook/entry/UserAddressbookEntry.java b/src/org/mxchange/jaddressbookcore/model/addressbook/entry/UserAddressbookEntry.java index aa00544..c2396f7 100644 --- a/src/org/mxchange/jaddressbookcore/model/addressbook/entry/UserAddressbookEntry.java +++ b/src/org/mxchange/jaddressbookcore/model/addressbook/entry/UserAddressbookEntry.java @@ -33,8 +33,11 @@ import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; import org.mxchange.jaddressbookcore.model.addressbook.Addressbook; +import org.mxchange.jaddressbookcore.model.addressbook.UserAddressbook; import org.mxchange.jcontacts.contact.Contact; +import org.mxchange.jcontacts.contact.UserContact; import org.mxchange.jcontactsbusiness.BusinessContact; +import org.mxchange.jcontactsbusiness.CompanyContact; /** * A POJO for address book entries @@ -60,7 +63,7 @@ public class UserAddressbookEntry implements AddressbookEntry { * Connection to table "business_contacts" (commercial contacts) */ @JoinColumn (name = "entry_business_contact_id", updatable = false) - @OneToOne (targetEntity = BusinessContact.class, cascade = CascadeType.REFRESH) + @OneToOne (targetEntity = CompanyContact.class, cascade = CascadeType.REFRESH) private BusinessContact addressbookEntryBusinessContact; /** @@ -83,14 +86,14 @@ public class UserAddressbookEntry implements AddressbookEntry { * Connection to table "contacts" (private contacts) */ @JoinColumn (name = "entry_private_contact_id", updatable = false) - @OneToOne (targetEntity = Contact.class, cascade = CascadeType.REFRESH) + @OneToOne (targetEntity = UserContact.class, cascade = CascadeType.REFRESH) private Contact addressbookEntryPrivateContact; /** * Connection to table "addressbooks" */ @JoinColumn (name = "entry_addressbook_id", nullable = false, updatable = false) - @OneToOne (targetEntity = Addressbook.class, cascade = CascadeType.REFRESH, optional = false) + @OneToOne (targetEntity = UserAddressbook.class, cascade = CascadeType.REFRESH, optional = false) private Addressbook addressbookId; @Override diff --git a/src/org/mxchange/jaddressbookcore/model/addressbook/shared/AddressbookShare.java b/src/org/mxchange/jaddressbookcore/model/addressbook/shared/AddressbookShare.java index f42eb9a..7165bd2 100644 --- a/src/org/mxchange/jaddressbookcore/model/addressbook/shared/AddressbookShare.java +++ b/src/org/mxchange/jaddressbookcore/model/addressbook/shared/AddressbookShare.java @@ -35,6 +35,7 @@ import javax.persistence.Temporal; import javax.persistence.TemporalType; import org.mxchange.jaddressbookcore.model.addressbook.Addressbook; import org.mxchange.jaddressbookcore.model.addressbook.UserAddressbook; +import org.mxchange.jusercore.model.user.LoginUser; import org.mxchange.jusercore.model.user.User; /** @@ -56,6 +57,7 @@ import org.mxchange.jusercore.model.user.User; ) } ) +@SuppressWarnings ("PersistenceUnitPresent") public class AddressbookShare implements ShareableAddressbook { /** @@ -90,14 +92,14 @@ public class AddressbookShare implements ShareableAddressbook { * User who is owning the share */ @JoinColumn (name = "share_owner_id", nullable = false, updatable = false) - @OneToOne (targetEntity = User.class, cascade = CascadeType.REFRESH, optional = false) + @OneToOne (targetEntity = LoginUser.class, cascade = CascadeType.REFRESH, optional = false) private User shareUserOwner; /** * User the address book is shared with */ @JoinColumn (name = "share_sharee_id", nullable = false, updatable = false) - @OneToOne (targetEntity = User.class, cascade = CascadeType.REFRESH, optional = false) + @OneToOne (targetEntity = LoginUser.class, cascade = CascadeType.REFRESH, optional = false) private User shareUserSharee; /** @@ -189,11 +191,13 @@ public class AddressbookShare implements ShareableAddressbook { } @Override + @SuppressWarnings ("ReturnOfDateField") public Calendar getShareCreated () { return this.shareCreated; } @Override + @SuppressWarnings ("AssignmentToDateFieldFromParameter") public void setShareCreated (final Calendar shareCreated) { this.shareCreated = shareCreated; } -- 2.39.5