@Override @SuppressWarnings("rawtypes") public Object readGenericEntity(Class<?> clazz, Object id) { Map<String, Object> md = daoHelper.getIdMetadata(clazz, (HibernateEntityManager) em); AbstractSingleColumnStandardBasicType type = (AbstractSingleColumnStandardBasicType) md.get("type"); if (type instanceof LongType) { id = Long.parseLong(String.valueOf(id)); } else if (type instanceof IntegerType) { id = Integer.parseInt(String.valueOf(id)); } return em.find(clazz, id); }
@Override public <T> T readGenericEntity(Class<T> clazz, Object id) { clazz = (Class<T>) DynamicDaoHelperImpl.getNonProxyImplementationClassIfNecessary(clazz); Map<String, Object> md = daoHelper.getIdMetadata(clazz, (HibernateEntityManager) em); AbstractSingleColumnStandardBasicType type = (AbstractSingleColumnStandardBasicType) md.get("type"); if (type instanceof LongType) { id = Long.parseLong(String.valueOf(id)); } else if (type instanceof IntegerType) { id = Integer.parseInt(String.valueOf(id)); } return em.find(clazz, id); }
public void setParameterValues(Properties parameters) { @SuppressWarnings("unchecked") final AbstractSingleColumnStandardBasicType<? extends Object> heuristicType = (AbstractSingleColumnStandardBasicType<? extends Object>) new TypeResolver().heuristicType(identifierType.getName(), parameters); if (heuristicType == null) { throw new HibernateException("Unsupported identifier type " + identifierType.getName()); } type = heuristicType; sqlTypes = new int[]{ type.sqlType() }; }
protected AbstractSingleColumnStandardBasicType<?> getType() { return type; }