From: Roland Haeder Date: Sun, 11 Oct 2015 20:30:24 +0000 (+0200) Subject: added named query for all countries X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=fc4c3071cbbb84edc5cae8af61f45f492d4864fd;p=jcountry-core.git added named query for all countries --- diff --git a/src/org/mxchange/jcountry/data/CountryData.java b/src/org/mxchange/jcountry/data/CountryData.java index fcdfb80..6bfb42f 100644 --- a/src/org/mxchange/jcountry/data/CountryData.java +++ b/src/org/mxchange/jcountry/data/CountryData.java @@ -22,6 +22,8 @@ import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; +import javax.persistence.NamedQueries; +import javax.persistence.NamedQuery; import javax.persistence.Table; /** @@ -31,6 +33,9 @@ import javax.persistence.Table; */ @Entity (name = "country_data") @Table (name = "country_data") +@NamedQueries ( + @NamedQuery (name = "AllCountries", query = "SELECT c FROM country_data AS c ORDER BY c.countryId ASC") +) public class CountryData implements Country, Comparable { /** @@ -42,7 +47,7 @@ public class CountryData implements Country, Comparable { * Id number */ @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) + @GeneratedValue (strategy = GenerationType.IDENTITY) @Column (name = "country_id", length = 20, nullable = false, updatable = false) private Long countryId;