/*
 *  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.place;

import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;

/**
 * @author Joe
 */
@Entity
@DiscriminatorValue(value = "cemetery")
@NamedQueries({
                      @NamedQuery(name = Cemetery.FIND_BY_NAME,
                                  query = "SELECT p FROM Cemetery p WHERE p.name = :name"),
                      @NamedQuery(name = Cemetery.FIND_ALL, query = "SELECT p FROM Cemetery p")
              })
public class Cemetery extends Place
{
    /**
     * Specifies the {@link String} that represents the {@link NamedQuery} to create a {@link TypedQuery} to get all
     * cemeteries.
     * <p>
     * For example:
     * <blockquote><pre>{@code TypedQuery<Cemetery> query = em.createNamedQuery(Cemetery.FIND_ALL, Cemetery.class);}
     */
    public static final String FIND_ALL = "Cemetery.findAll";

    /**
     * Specifies the {@link String} that represents the {@link NamedQuery} to create a {@link TypedQuery} to get all
     * cemeteries by name.
     * <p>
     * For example:
     * <blockquote><pre>{@code TypedQuery<Cemetery> query = em.createNamedQuery(Cemetery.FIND_BY_NAME, Cemetery.class);
     * query.setParameter("name", name);}</pre></blockquote>
     */
    public static final String FIND_BY_NAME = "Cemetery.findByName";

    /**
     * No-argument constructor for JPA.
     */
    public Cemetery()
    {
    }

    /**
     * Creates a new cemetery with the specified name.
     *
     * @param name the name of the cemetery
     */
    public Cemetery(String name)
    {
        super(name);
    }

    /**
     * Returns the city that the cemetery is in.
     *
     * @return the city that the cemetery is in
     */
    public City getCity()
    {
        return (City) getRegionByClass(City.class);
    }

    /**
     * Returns the county that the cemetery is in.
     *
     * @return the county that the cemetery is in
     */
    public County getCounty()
    {
        return (County) getRegionByClass(County.class);
    }

    /**
     * Returns the country that the cemetery is in.
     *
     * @return the country that the cemetery is in
     */
    public Country getCountry()
    {
        return (Country) getRegionByClass(Country.class);
    }

    /**
     * Returns the state that the cemetery is in.
     *
     * @return the state that the cemetery is in
     */
    public State getState()
    {
        return (State) getRegionByClass(State.class);
    }

    /**
     * {@inheritDoc}
     *
     * @return {@inheritDoc}
     */
    @Override
    public String getLink()
    {
        return super.queryLink(toString());
    }
}

@@ -543,16 +543,206 @@
 eries(%7B%0A
+                      @NamedQuery(name = Cemetery.FIND_BY_NAME_AND_REGION,%0A                                  query = %22SELECT p FROM Cemetery p WHERE p.name = :name AND p.region = :region%22),%0A
         
@@ -797,16 +797,16 @@
 Y_NAME,%0A
-
         
@@ -1331,16 +1331,35 @@
 class);%7D
+%3C/pre%3E%3C/blockquote%3E
 %0A     */
@@ -1786,32 +1786,32 @@
 kquote%3E%0A     */%0A
-
     public stati
@@ -1862,16 +1862,550 @@
 ByName%22;
+%0A    %0A    /**%0A     * Specifies the %7B@link String%7D that represents the %7B@link NamedQuery%7D to create a %7B@link TypedQuery%7D to get all %0A     * cemeteries by name and region.%0A     * %3Cp%3E%0A     * For example:%0A     * %3Cblockquote%3E%3Cpre%3E%7B@code TypedQuery%3CCemetery%3E query = em.createNamedQuery(Cemetery.FIND_BY_NAME_AND_REGION, Cemetery.class);%0A     * query.setParameter(%22name%22, name);%0A     * query.setParameter(%22region%22, region);%7D%3C/pre%3E%3C/blockquote%3E%0A     */%0A    public static final String FIND_BY_NAME_AND_REGION = %22Cemetery.findByNameAndRegion%22;
 %0A%0A    /*

Update Cemetery.java