Thursday, 14 April 2011

Create a flight database , corresponding Pojo class for entity

Create a flight database:
create table flights_test(flightno varchar(10), carrier
varchar(30), kahase varchar(30), kahatak varchar(30));

insert into flights_test values('JL-120','JET
AIRWAYS'
, 'MUMBAI', 'JAIPUR');
insert into flights_test values('KL-
102'
,'KINGFISHER', 'DELHI', 'MUMBAI');
insert into flights_test values('AI-
229'
,'INDIAN', 'KOLKATA', 'DELHI');
insert into flights_test values('SP-
109'
,'SPICEJET', 'CHENNAI', 'MUMBAI');
insert into flights_test values('GO-120','GO
AIR'
, 'MUMBAI', 'BANGALORE');

kahase in hindi means - from Where,i.e. source of flight
kahatak in hindi means - till where i.e. destination of flight



Entity corresponding to database :
package entity;

public class Flight {

private String flightNo;
private String carrier;
private String from;
private String to;

public String getFlightNo() {
return flightNo;
}
public void setFlightNo(String flightNo) {
this.flightNo = flightNo;
}
public String getCarrier() {
return carrier;
}
public void setCarrier(String carrier) {
this.carrier = carrier;
}
public String getFrom() {
return from;
}
public void setFrom(String from) {
this.from = from;
}
public String getTo() {
return to;
}
public void setTo(String to
package entity;

public class Flight {

private String flightNo;
private String carrier;
private String from;
private String to;

public String getFlightNo() {
return flightNo;
}
public void setFlightNo(String flightNo) {
this.flightNo = flightNo;
}
public String getCarrier() {
return carrier;
}
public void setCarrier(String carrier) {
this.carrier = carrier;
}
public String getFrom() {
return from;
}
public void setFrom(String from) {
this.from = from;
}
public String getTo() {
return to;
}
public void setTo(String to) {
this.to = to;
}


}
)
{ this.to = to; } }

This database and pojo is used by following posts, eg. -


  1. Using jdbc-template to create data access layer 
  2. Mapping the resultset to object or class 
  3. The Spring Jdbc Template for database access - Tutorial

No comments:

Post a Comment