/*
 *  The MIT License (MIT)
 *
 *  View the full license at:
 *  https://github.com/hendrixjoseph/FamilyTree/blob/master/LICENSE.md
 *
 *  Copyright (c) 2015 Joseph Hendrix
 *
 *  Hosted on GitHub at https://github.com/hendrixjoseph/FamilyTree
 *
 */

package edu.wright.hendrix11.familyTree.entity.event;

import edu.wright.hendrix11.familyTree.entity.Person;
import edu.wright.hendrix11.familyTree.entity.compositeKey.SinglePersonEventPK;

import javax.persistence.DiscriminatorColumn;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;

/**
 * @author Joe Hendrix
 */
@Entity
@Table(name = "EVENT")
@IdClass(SinglePersonEventPK.class)
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name = "TYPE")
public abstract class SinglePersonEvent extends Event
{

    @Id
    @OneToOne
    @JoinColumn(name = "PERSON_ID")
    private Person person;

    @Id
    private String type;

    /**
     *
     */
    protected SinglePersonEvent()
    {
        this.type = this.getClass().getSimpleName().toLowerCase();
    }

    /**
     * @return
     */
    public Person getPerson()
    {
        return person;
    }

    /**
     * @param person
     */
    public void setPerson(Person person)
    {
        this.person = person;
    }

    /**
     * @return
     */
    public String getType()
    {
        return type;
    }

    //    public void setType(String type)
    //    {
    //        this.type = type;
    //    }
}

@@ -955,63 +955,530 @@
 E%22)%0A
-public abstract class SinglePersonEvent extends Event%0A%7B
+@NamedQuery(name = SinglePersonEvent.FIND_ALL, query = %22SELECT e FROM SinglePersonEvent e%22)%0Apublic abstract class SinglePersonEvent extends Event%0A%7B%0A    /**%0A    * Specifies the %7B@link String%7D that represents the %7B@link NamedQuery%7D to create a %7B@link TypedQuery%7D%0A    * to get all single-person events.%0A    *%0A    * For example: %7B@code TypedQuery%3CSinglePersonEvent%3E query = em.createNamedQuery(SinglePersonEvent.FIND_ALL, SinglePersonEvent.class);%7D%0A    */%0A    public static final String FIND_ALL = %22SinglePersonEvent.findAll%22;
 %0A%0A  
@@ -1605,24 +1605,52 @@
   /**%0A     *
+ No-arg constructor for JPA.
 %0A     */%0A   
@@ -1779,233 +1779,634 @@
   * 
-@return%0A     */%0A    public Person getPerson()%0A    %7B%0A        return person;%0A    %7D%0A%0A    /**%0A     * @param person%0A     */%0A    public void setPerson(Person person)%0A    %7B%0A        this.person = person;%0A    %7D%0A%0A    /**%0A     * @return
+Returns the person associated with this event.%0A     * %0A     * @return the person associated with this event%0A     */%0A    public Person getPerson()%0A    %7B%0A        return person;%0A    %7D%0A%0A    /**%0A     * Sets the person associated with this event.%0A     * %0A     * @param person the person associated with this event%0A     */%0A    public void setPerson(Person person)%0A    %7B%0A        this.person = person;%0A    %7D%0A%0A    /**%0A     * Returns the discriminator column value. Normally this isn't needed with JPA, but the discriminator column %0A     * is part of the primary key for this entity.%0A     * %0A     * @return the discriminator column value
 %0A   

Update SinglePersonEvent.java