org.hibernate.type.FloatType Java Examples
The following examples show how to use
org.hibernate.type.FloatType.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AssessmentUserDAOHibernate.java From lams with GNU General Public License v2.0 | 6 votes |
@SuppressWarnings("unchecked") @Override public Object[] getStatsMarksForLeaders(Long toolContentId) { NativeQuery<Object[]> query = getSession().createNativeQuery(FIND_MARK_STATS_FOR_LEADERS) .addScalar("min_grade", FloatType.INSTANCE) .addScalar("avg_grade", FloatType.INSTANCE) .addScalar("max_grade", FloatType.INSTANCE) .addScalar("num_complete", IntegerType.INSTANCE); query.setParameter("toolContentId", toolContentId); List list = query.list(); if ((list == null) || (list.size() == 0)) { return null; } else { return (Object[]) list.get(0); } }
Example #2
Source File: McUserDAO.java From lams with GNU General Public License v2.0 | 6 votes |
@SuppressWarnings("rawtypes") @Override public Object[] getStatsMarksBySession(Long sessionId) { Query<?> query = getSession().createSQLQuery(FIND_MARK_STATS_FOR_SESSION) .addScalar("min_grade", FloatType.INSTANCE) .addScalar("avg_grade", FloatType.INSTANCE) .addScalar("max_grade", FloatType.INSTANCE); query.setParameter("sessionId", sessionId); List<?> list = query.list(); if ((list == null) || (list.size() == 0)) { return null; } else { return (Object[]) list.get(0); } }
Example #3
Source File: McUserDAO.java From lams with GNU General Public License v2.0 | 6 votes |
@SuppressWarnings("rawtypes") @Override public Object[] getStatsMarksForLeaders(Long toolContentId) { Query<?> query = getSession().createSQLQuery(FIND_MARK_STATS_FOR_LEADERS) .addScalar("min_grade", FloatType.INSTANCE) .addScalar("avg_grade", FloatType.INSTANCE) .addScalar("max_grade", FloatType.INSTANCE) .addScalar("num_complete", IntegerType.INSTANCE); query.setParameter("toolContentId", toolContentId); List<?> list = query.list(); if ((list == null) || (list.size() == 0)) { return null; } else { return (Object[]) list.get(0); } }
Example #4
Source File: ScratchieSessionDAOHibernate.java From lams with GNU General Public License v2.0 | 6 votes |
@Override public Object[] getStatsMarksForLeaders(Long toolContentId) { NativeQuery<?> query = getSession().createNativeQuery(FIND_MARK_STATS) .addScalar("min_grade", FloatType.INSTANCE) .addScalar("avg_grade", FloatType.INSTANCE) .addScalar("max_grade", FloatType.INSTANCE) .addScalar("num_complete", IntegerType.INSTANCE); query.setParameter("toolContentId", toolContentId); @SuppressWarnings("unchecked") List<Object[]> list = (List<Object[]>) query.list(); if ((list == null) || (list.size() == 0)) { return null; } else { return (Object[]) list.get(0); } }
Example #5
Source File: AssessmentUserDAOHibernate.java From lams with GNU General Public License v2.0 | 5 votes |
@SuppressWarnings("rawtypes") @Override public Object[] getStatsMarksBySession(Long sessionId) { Query query = getSession().createNativeQuery(FIND_MARK_STATS_FOR_SESSION) .addScalar("min_grade", FloatType.INSTANCE) .addScalar("avg_grade", FloatType.INSTANCE) .addScalar("max_grade", FloatType.INSTANCE); query.setParameter("sessionId", sessionId); List list = query.list(); if ((list == null) || (list.size() == 0)) { return null; } else { return (Object[]) list.get(0); } }
Example #6
Source File: SessionRestore.java From unitime with Apache License 2.0 | 5 votes |
protected Object get(Class clazz, String id) { if (clazz.equals(String.class) || clazz.equals(StringType.class)) return id; if (clazz.equals(Character.class) || clazz.equals(CharacterType.class)) return (id == null || id.isEmpty() ? null : id.charAt(0)); if (clazz.equals(Byte.class) || clazz.equals(ByteType.class)) return Byte.valueOf(id); if (clazz.equals(Short.class) || clazz.equals(ShortType.class)) return Short.valueOf(id); if (clazz.equals(Integer.class) || clazz.equals(IntegerType.class)) return Integer.valueOf(id); if (clazz.equals(Long.class) || clazz.equals(LongType.class)) return Long.valueOf(id); if (clazz.equals(Float.class) || clazz.equals(FloatType.class)) return Float.valueOf(id); if (clazz.equals(Double.class) || clazz.equals(DoubleType.class)) return Double.valueOf(id); if (clazz.equals(Boolean.class) || clazz.equals(BooleanType.class)) return Boolean.valueOf(id); Map<String, Entity> entities = iEntities.get(clazz.getName()); if (entities != null) { Entity entity = entities.get(id); if (entity != null) return entity.getObject(); } for (Map.Entry<String, Map<String, Entity>> entry: iEntities.entrySet()) { Entity o = entry.getValue().get(id); if (o != null && clazz.isInstance(o.getObject())) return o.getObject(); } if (clazz.equals(Session.class)) return ((Entity)iEntities.get(Session.class.getName()).values().iterator().next()).getObject(); if (clazz.equals(Student.class)) return checkUnknown(clazz, id, iStudents.get(id)); if (iIsClone) return checkUnknown(clazz, id, iHibSession.get(clazz, clazz.equals(ItypeDesc.class) ? (Serializable) Integer.valueOf(id) : (Serializable) Long.valueOf(id))); return checkUnknown(clazz, id, null); }
Example #7
Source File: PostgreSQLToRankCDFunction.java From JuniperBot with GNU General Public License v3.0 | 4 votes |
@Override public Type getReturnType(Type columnType, Mapping mapping) throws QueryException { return FloatType.INSTANCE; }
Example #8
Source File: Query.java From lams with GNU General Public License v2.0 | 3 votes |
/** * Bind a positional float-valued parameter. * * @param position The parameter position * @param val The bind value * * @return {@code this}, for method chaining * * @deprecated (since 5.2) use {@link #setParameter(int, Object)} or {@link #setParameter(int, Object, Type)} * instead */ @Deprecated @SuppressWarnings("unchecked") default Query<R> setFloat(int position, float val) { setParameter( position, val, FloatType.INSTANCE ); return this; }
Example #9
Source File: Query.java From lams with GNU General Public License v2.0 | 3 votes |
/** * Bind a named float-valued parameter. * * @param name The parameter name * @param val The bind value * * @return {@code this}, for method chaining * * @deprecated (since 5.2) use {@link #setParameter(int, Object)} or {@link #setParameter(int, Object, Type)} * instead */ @Deprecated @SuppressWarnings("unchecked") default Query<R> setFloat(String name, float val) { setParameter( name, val, FloatType.INSTANCE ); return this; }
Example #10
Source File: Query.java From lams with GNU General Public License v2.0 | 3 votes |
/** * Bind a positional float-valued parameter. * * @param position The parameter position * @param val The bind value * * @return {@code this}, for method chaining * * @deprecated (since 5.2) use {@link #setParameter(int, Object)} or {@link #setParameter(int, Object, Type)} * instead */ @Deprecated @SuppressWarnings("unchecked") default Query<R> setFloat(int position, float val) { setParameter( position, val, FloatType.INSTANCE ); return this; }
Example #11
Source File: Query.java From lams with GNU General Public License v2.0 | 3 votes |
/** * Bind a named float-valued parameter. * * @param name The parameter name * @param val The bind value * * @return {@code this}, for method chaining * * @deprecated (since 5.2) use {@link #setParameter(String, Object)} or {@link #setParameter(String, Object, Type)} * instead */ @Deprecated @SuppressWarnings("unchecked") default Query<R> setFloat(String name, float val) { setParameter( name, val, FloatType.INSTANCE ); return this; }