]> git.mxchange.org Git - jcountry-core.git/commitdiff
added named query for all countries
authorRoland Haeder <roland@mxchange.org>
Sun, 11 Oct 2015 20:30:24 +0000 (22:30 +0200)
committerRoland Haeder <roland@mxchange.org>
Sun, 11 Oct 2015 20:30:24 +0000 (22:30 +0200)
src/org/mxchange/jcountry/data/CountryData.java

index fcdfb80e2e14bea92e385e2f5e554ab177a438c5..6bfb42f19ead8e7a90222daa2613db1f91642033 100644 (file)
@@ -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<Country> {
 
        /**
@@ -42,7 +47,7 @@ public class CountryData implements Country, Comparable<Country> {
         * Id number
         */
        @Id
-       @GeneratedValue(strategy = GenerationType.IDENTITY)
+       @GeneratedValue (strategy = GenerationType.IDENTITY)
        @Column (name = "country_id", length = 20, nullable = false, updatable = false)
        private Long countryId;