/*
 * Copyright 2016 Hewlett-Packard Development Company, L.P.
 * Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License.
 */

package com.hp.autonomy.frontend.find.core.savedsearches;

import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import java.util.Set;
import java.util.UUID;

@Entity
@Table(name = "users")
@Data
@EqualsAndHashCode(exclude = {"searches", "userId"})
@NoArgsConstructor
public class UserEntity {

    @Id
    @Column(name = "user_id")
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long userId;
    private String domain;

    @Column(name = "user_store")
    private String userStore;

    private UUID uuid;
    private Long uid;

    @JsonIgnore
    @OneToMany(mappedBy = "user", fetch = FetchType.EAGER)
    private Set<SavedSearch> searches;
}

@@ -449,16 +449,613 @@
 .UUID;%0A%0A
+/**%0A * Single entity that defines multiple types of user for our various implementations.%0A *%0A * We cannot use inheritance in this case because it would mean we would have to employ the%0A * %7B@link org.hibernate.annotations.Any%7D annotation on the user entity of %7B@link SavedSearch%7D.%0A *%0A * This annotation requires you to define in place all the possible concrete types the field could%0A * take at runtime.  This in turn would mean we have to define implementation-specific children of%0A * %7B@link SavedSearch%7D, but then we would lose the centralisation of %7B@link SavedQuery%7D and other search types.%0A */%0A
 @Entity%0A

Add comment for user entity justifying lack of inheritance [rev: trivial]