org.hibernate.type.CharacterType Java Examples

The following examples show how to use org.hibernate.type.CharacterType. 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: SessionRestore.java    From unitime with Apache License 2.0 5 votes vote down vote up
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 #2
Source File: Query.java    From lams with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Bind a positional char-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> setCharacter(int position, char val) {
	setParameter( position, val, CharacterType.INSTANCE );
	return this;
}
 
Example #3
Source File: Query.java    From lams with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Bind a named char-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> setCharacter(String name, char val) {
	setParameter( name, val, CharacterType.INSTANCE );
	return this;
}
 
Example #4
Source File: Query.java    From lams with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Bind a positional char-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> setCharacter(int position, char val) {
	setParameter( position, val, CharacterType.INSTANCE );
	return this;
}
 
Example #5
Source File: Query.java    From lams with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Bind a named char-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> setCharacter(String name, char val) {
	setParameter( name, val, CharacterType.INSTANCE );
	return this;
}