List of usage examples for org.hibernate.type.descriptor.java DataHelper extractString
public static String extractString(final Clob value)
From source file:org.jasig.portal.dao.usertype.QNameTypeDescriptor.java
License:Apache License
@Override public <X> QName wrap(X value, WrapperOptions options) { if (value == null) { return null; }/*from www. ja v a 2s . com*/ final String strValue; if (String.class.isInstance(value)) { strValue = (String) value; } else if (Reader.class.isInstance(value)) { strValue = DataHelper.extractString((Reader) value); } else if (Clob.class.isInstance(value) || DataHelper.isNClob(value.getClass())) { try { strValue = DataHelper.extractString(((Clob) value).getCharacterStream()); } catch (SQLException e) { throw new HibernateException("Unable to access lob stream", e); } } else { throw unknownWrap(value.getClass()); } return this.fromString(strValue); }