import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
+import javax.persistence.NamedQueries;
+import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
*/
@Entity (name = "email_changes")
@Table (name = "email_changes")
+@NamedQueries (
+ @NamedQuery (name = "SearchEmailChangeByEmail", query = "SELECT e FROM email_changes AS e WHERE LOWER(e.emailAddress) LIKE LOWER(:email)")
+)
public class EmailAddressChange implements ChangeableEmailAddress {
/**
this.emailChangeStatus = EmailChangeStatus.NEW;
}
+ /**
+ * Constructor with user, email address and creation timestamp to set
+ * <p>
+ * @param user User instance
+ * @param emailAddress Email address to queue
+ * @param emailChangeCreated Timestamp for creation
+ */
+ public EmailAddressChange (final User user, final String emailAddress, final Calendar emailChangeCreated) {
+ // Call super constructor
+ this();
+
+ // Set all
+ this.emailAddress = emailAddress;
+ this.emailChangeUser = user;
+ this.emailChangeCreated = emailChangeCreated;
+ }
+
@Override
public boolean equals (final Object object) {
if (this == object) {
{
@NamedQuery (name = "AllUserNames", query = "SELECT DISTINCT u.userName FROM users AS u ORDER BY u.userId ASC"),
@NamedQuery (name = "AllEmailAddresses", query = "SELECT DISTINCT c.contactEmailAddress FROM contacts AS c INNER JOIN users AS u ON u.userContact = c ORDER BY c.contactId ASC"),
+ @NamedQuery (name = "SearchUser", query = "SELECT u FROM users AS u WHERE u = :param"),
@NamedQuery (name = "SearchUserName", query = "SELECT u FROM users AS u WHERE LOWER(u.userName) LIKE LOWER(:param)"),
@NamedQuery (name = "SearchUserId", query = "SELECT u FROM users AS u WHERE u.userId = :id"),
@NamedQuery (name = "SearchEmailAddress", query = "SELECT u FROM users AS u INNER JOIN contacts AS c ON u.userContact = c WHERE LOWER(c.contactEmailAddress) LIKE LOWER(:param)"),