@@ -0,0 +1,2033 @@
+package com.raj.frs.dao;%0D%0A%0D%0Aimport java.math.BigDecimal;%0D%0Aimport java.util.ArrayList;%0D%0Aimport java.util.List;%0D%0A%0D%0Aimport org.hibernate.HibernateException;%0D%0Aimport org.hibernate.SQLQuery;%0D%0Aimport org.hibernate.Session;%0D%0Aimport org.hibernate.SessionFactory;%0D%0Aimport org.hibernate.Transaction;%0D%0Aimport org.springframework.beans.factory.annotation.Autowired;%0D%0Aimport org.springframework.stereotype.Repository;%0D%0Aimport org.springframework.transaction.annotation.Transactional;%0D%0A%0D%0Aimport com.raj.frs.bean.FlightBean;%0D%0A%0D%0A@Repository%0D%0A@Transactional%0D%0Apublic class FlightDAOImpl implements FlightDAO%7B%0D%0A%09%0D%0A%09@Autowired%0D%0A%09SessionFactory sessionFactory;%0D%0A%0D%0A%09@Override%0D%0A%09public String findSequence() %7B%0D%0A%0D%0A%09%09String flight_seq = %22FRS_SEQ_FLIGHT_ID%22;%0D%0A%09%09Session session=sessionFactory.openSession();%0D%0A%09%09Transaction tx=session.beginTransaction();%0D%0A%09%09%0D%0A%09%09%09%09%0D%0A%09%09SQLQuery query=session.createSQLQuery(%22select %22+flight_seq+%22.nextval from dual%22);%0D%0A%09%09%0D%0A%09%09List list=query.list();%0D%0A%09%09BigDecimal big=(BigDecimal)list.get(0);%0D%0A%09%09%0D%0A%09%09%0D%0A%09%09return String.valueOf(big);%0D%0A%09%7D%0D%0A%0D%0A%09@Override%0D%0A%09public String createFlight(FlightBean flight) %7B%0D%0A%0D%0A%09%09%0D%0A%09%09try%7B%0D%0A%09%09%09String sequence = findSequence();%0D%0A%09%09%09sequence = flight.getFlightName().substring(0, 2).toUpperCase()+sequence;%0D%0A%09%09%09flight.setFlightID(sequence);%0D%0A%09%09%09Session session=sessionFactory.openSession();%0D%0A%09%09%09Transaction tx=session.beginTransaction();%0D%0A%09%09%09session.save(flight);%0D%0A%09%09%09tx.commit();%0D%0A%09%09%09%7Dcatch(HibernateException he)%7B%0D%0A%09%09%09%09return %22FAIL%22;%0D%0A%09%09%09%7Dcatch(Exception e)%7B%0D%0A%09%09%09%09return %22ERROR%22;%0D%0A%09%09%09%7D%0D%0A%09%09%09return %22SUCCESS%22;%0D%0A%0D%0A%09%7D%0D%0A%0D%0A%09@Override%0D%0A%09public int deleteFlight(ArrayList%3CString%3E flightID) %7B%0D%0A%09%09// TODO Auto-generated method stub%0D%0A%09%09return 0;%0D%0A%09%7D%0D%0A%0D%0A%09@Override%0D%0A%09public boolean updateFlight(FlightBean flight) %7B%0D%0A%09%09// TODO Auto-generated method stub%0D%0A%09%09return false;%0D%0A%09%7D%0D%0A%0D%0A%09@Override%0D%0A%09public FlightBean findByID(String flightID) %7B%0D%0A%09%09// TODO Auto-generated method stub%0D%0A%09%09return null;%0D%0A%09%7D%0D%0A%0D%0A%09@Override%0D%0A%09public ArrayList%3CFlightBean%3E findAll() %7B%0D%0A%09%09// TODO Auto-generated method stub%0D%0A%09%09return null;%0D%0A%09%7D%0D%0A%0D%0A%7D%0D%0A

Add FlightDAOImpl