From fc4c3071cbbb84edc5cae8af61f45f492d4864fd Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Sun, 11 Oct 2015 22:30:24 +0200 Subject: [PATCH] added named query for all countries --- src/org/mxchange/jcountry/data/CountryData.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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; -- 2.39.5