1 22 package org.jboss.ejb3.test.entity; 23 24 import javax.persistence.Entity; 25 import javax.persistence.Id; 26 import javax.persistence.NamedQueries; 27 import javax.persistence.NamedQuery; 28 import javax.persistence.GeneratedValue; 29 import javax.persistence.GenerationType; 30 31 37 @Entity 38 @NamedQueries ( 39 {@NamedQuery(name="allAirports", query="from Airport"), 40 @NamedQuery(name="airportById", query="from Airport a where a.id=:id")}) 41 public class Airport 42 { 43 44 Long id; 45 String code; 46 String city; 47 48 public Airport() {} 49 50 public Airport(String code, String city) 51 { 52 this.code = code; 53 this.city = city; 54 } 55 56 @Id 57 @GeneratedValue(strategy= GenerationType.AUTO) 58 public Long getId() 59 { 60 return id; 61 } 62 63 public void setId(Long id) 64 { 65 this.id = id; 66 } 67 68 public String getCode() 69 { 70 return code; 71 } 72 73 public void setCode(String code) 74 { 75 this.code = code; 76 } 77 78 public String getCity() 79 { 80 return city; 81 } 82 83 public void setCity(String city) 84 { 85 this.city = city; 86 } 87 88 } 89 | Popular Tags |