示例#1
0
 /** {@inheritDoc} */
 public TypedQuery<X> setParameter(String name, Calendar value, TemporalType temporalType) {
   try {
     if (temporalType == DATE) {
       query.setCalendarDate(name, value);
     } else if (temporalType == TIME) {
       throw new IllegalArgumentException("not yet implemented");
     } else if (temporalType == TIMESTAMP) {
       query.setCalendar(name, value);
     }
     registerParameterBinding(getParameter(name), value);
     return this;
   } catch (QueryParameterException e) {
     throw new IllegalArgumentException(e);
   } catch (HibernateException he) {
     throw getEntityManager().convert(he);
   }
 }
示例#2
0
 /** {@inheritDoc} */
 public TypedQuery<X> setParameter(int position, Calendar value, TemporalType temporalType) {
   try {
     if (isJpaPositionalParameter(position)) {
       String name = Integer.toString(position);
       this.setParameter(name, value, temporalType);
     } else {
       if (temporalType == DATE) {
         query.setCalendarDate(position - 1, value);
       } else if (temporalType == TIME) {
         throw new IllegalArgumentException("not yet implemented");
       } else if (temporalType == TIMESTAMP) {
         query.setCalendar(position - 1, value);
       }
       registerParameterBinding(getParameter(position), value);
     }
     return this;
   } catch (QueryParameterException e) {
     throw new IllegalArgumentException(e);
   } catch (HibernateException he) {
     throw getEntityManager().convert(he);
   }
 }