/** * {@inheritDoc} */ public TypedQuery<X> setParameter(int position, Object value) { try { if ( isJpaPositionalParameter( position ) ) { this.setParameter( Integer.toString( position ), value ); } else { query.setParameter( position - 1, value ); registerParameterBinding( getParameter( position ), value ); } return this; } catch (QueryParameterException e) { throw new IllegalArgumentException( e ); } catch (HibernateException he) { throw getEntityManager().convert( he ); } }
/** * {@inheritDoc} */ public TypedQuery<X> setParameter(String name, Object value) { try { if ( value instanceof Collection ) { query.setParameterList( name, (Collection) value ); } else { query.setParameter( name, value ); } registerParameterBinding( getParameter( name ), value ); return this; } catch (QueryParameterException e) { throw new IllegalArgumentException( e ); } catch (HibernateException he) { throw getEntityManager().convert( he ); } }
/** * {@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 ); } }
/** * {@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 ); } }
/** * {@inheritDoc} */ public TypedQuery<X> setParameter(String name, Date value, TemporalType temporalType) { try { if ( temporalType == DATE ) { query.setDate( name, value ); } else if ( temporalType == TIME ) { query.setTime( name, value ); } else if ( temporalType == TIMESTAMP ) { query.setTimestamp( name, value ); } registerParameterBinding( getParameter( name ), value ); return this; } catch (QueryParameterException e) { throw new IllegalArgumentException( e ); } catch (HibernateException he) { throw getEntityManager().convert( he ); } }
/** * {@inheritDoc} */ public TypedQuery<X> setParameter(int position, Date value, TemporalType temporalType) { try { if ( isJpaPositionalParameter( position ) ) { String name = Integer.toString( position ); this.setParameter( name, value, temporalType ); } else { if ( temporalType == DATE ) { query.setDate( position - 1, value ); } else if ( temporalType == TIME ) { query.setTime( position - 1, value ); } else if ( temporalType == TIMESTAMP ) { query.setTimestamp( position - 1, value ); } registerParameterBinding( getParameter( position ), value ); } return this; } catch (QueryParameterException e) { throw new IllegalArgumentException( e ); } catch (HibernateException he) { throw getEntityManager().convert( he ); } }