/*
 *  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 = "2")
@NamedQueries({
                      @NamedQuery(name = State.FIND_BY_NAME, query = "SELECT p FROM State p WHERE p.name = :name"),
                      @NamedQuery(name = State.FIND_ALL, query = "SELECT p FROM State p")
              })
public class State extends Place
{

    /**
     *
     */
    public static final String FIND_ALL = "State.findAll";

    /**
     *
     */
    public static final String FIND_BY_NAME = "State.findByName";

    /**
     *
     * @return
     */
    public Country getCountry()
    {
        return (Country) getRegionByClass(Country.class);
    }

    /**
     *
     * @return
     */
    @Override
    public String getLink()
    {
        return getName();
    }
}

@@ -539,16 +539,155 @@
 eries(%7B%0A
+                      @NamedQuery(name = State.FIND_BY_NAME, query = %22SELECT p FROM State p WHERE p.name = :name AND p.region = :region%22),%0A
         
@@ -790,24 +790,24 @@
  = :name%22),%0A
-
             
@@ -943,32 +943,110 @@
 %0A%0A    /**%0A     *
+ Contains the %7B@link String%7D to create a %7B@link TypedQuery%7D to get all States.
 %0A     */%0A    pub
@@ -1113,32 +1113,32 @@
 %0A     *%0A     */%0A
-
     public stati
@@ -1186,16 +1186,134 @@
 ByName%22;
+%0A    %0A        /**%0A     *%0A     */%0A    public static final String FIND_BY_NAME_AND_REGION = %22State.findByNameAndRegion%22;
 %0A%0A    /*

Update State.java