List of usage examples for org.springframework.dao DataAccessException DataAccessException
public DataAccessException(@Nullable String msg, @Nullable Throwable cause)
From source file:cz.fi.muni.pa036.airticketbooking.dao.impl.BaggageDaoImpl.java
@Override public List<Baggage> getAll() { try {/*from www. jav a2 s . c o m*/ Query q = em.createQuery("FROM Plane"); List<Baggage> planes = q.getResultList(); return Collections.unmodifiableList(planes); } catch (PersistenceException | IllegalArgumentException ex) { throw new DataAccessException(ex.getMessage(), ex) { }; } }
From source file:cz.fi.muni.pa036.airticketbooking.dao.impl.SeatReservationDaoImpl.java
@Override public SeatReservation getById(Long id) { try {//from w ww . ja va 2s . com if (id == null) { throw new IllegalArgumentException("Id cannot be null."); } SeatReservation objectTemp = (SeatReservation) em.find(SeatReservation.class, id); return objectTemp; } catch (PersistenceException | IllegalArgumentException ex) { throw new DataAccessException(ex.getMessage(), ex) { }; } }
From source file:cz.fi.muni.pa036.airticketbooking.dao.impl.SeatDaoImpl.java
@Override public List<Seat> getByPlane(Long plane) { try {/* www . j a v a2 s . c o m*/ Query q = em.createQuery("FROM Seat WHERE plane_id=:plane"); q.setParameter("plane", plane); List<Seat> planes = q.getResultList(); return Collections.unmodifiableList(planes); } catch (PersistenceException | IllegalArgumentException ex) { throw new DataAccessException(ex.getMessage(), ex) { }; } }
From source file:cz.fi.muni.pa036.airticketbooking.dao.impl.PlaneDaoImpl.java
@Override public List<Plane> getByAirline(Long airline) { try {/* w w w .ja v a2 s .c o m*/ Query q = em.createQuery("FROM Plane WHERE airline_id=:airline"); q.setParameter("airline", airline); List<Plane> planes = q.getResultList(); return Collections.unmodifiableList(planes); } catch (PersistenceException | IllegalArgumentException ex) { throw new DataAccessException(ex.getMessage(), ex) { }; } }
From source file:cz.fi.muni.pa036.airticketbooking.dao.impl.BaggageDaoImpl.java
@Override public List<Baggage> getByFlightTicket(Long ticket) { try {/* ww w . j av a2 s. c o m*/ Query q = em.createQuery("FROM Baggage WHERE flight_ticket_id=:ticket"); q.setParameter("ticket", ticket); List<Baggage> planes = q.getResultList(); return Collections.unmodifiableList(planes); } catch (PersistenceException | IllegalArgumentException ex) { throw new DataAccessException(ex.getMessage(), ex) { }; } }
From source file:cz.fi.muni.pa036.airticketbooking.dao.impl.SeatReservationDaoImpl.java
@Override public List<SeatReservation> getAll() { try {// ww w . ja v a 2 s .co m Query q = em.createQuery("FROM SeatReservation"); List<SeatReservation> planes = q.getResultList(); return Collections.unmodifiableList(planes); } catch (PersistenceException | IllegalArgumentException ex) { throw new DataAccessException(ex.getMessage(), ex) { }; } }
From source file:cz.fi.muni.pa036.airticketbooking.dao.impl.SeatReservationDaoImpl.java
@Override public List<SeatReservation> getByTicket(Long ticket) { try {/*from w w w . j av a2s. co m*/ Query q = em.createQuery("FROM SeatReservation WHERE ticket_id=:ticket"); q.setParameter("ticket", ticket); List<SeatReservation> planes = q.getResultList(); return Collections.unmodifiableList(planes); } catch (PersistenceException | IllegalArgumentException ex) { throw new DataAccessException(ex.getMessage(), ex) { }; } }
From source file:org.grails.datastore.mapping.redis.engine.RedisPropertyValueIndexer.java
@SuppressWarnings("serial") private String urlEncode(Object value) { try {//ww w . j a va2s . c o m return URLEncoder.encode(value.toString(), "UTF-8"); } catch (UnsupportedEncodingException e) { throw new DataAccessException("Cannot encoding Redis key: " + e.getMessage(), e) { }; } }
From source file:cz.fi.muni.pa036.airticketbooking.dao.impl.SeatReservationDaoImpl.java
@Override public List<SeatReservation> getBySeat(Long seat) { try {/*from w ww . j a v a 2 s . c om*/ Query q = em.createQuery("FROM SeatReservation WHERE seat_id=:seat"); q.setParameter("seat", seat); List<SeatReservation> planes = q.getResultList(); return Collections.unmodifiableList(planes); } catch (PersistenceException | IllegalArgumentException ex) { throw new DataAccessException(ex.getMessage(), ex) { }; } }