Code example for HibernateException

0
	public URL fromString(String string) {
		try { 
			return new URL( string );
		} 
		catch ( MalformedURLException e ) {
			throw new HibernateException( "Unable to convert string [" + string + "] to URL : " + e );
		} 
	} 
 
	@SuppressWarnings({ "unchecked" }) 
	public <X> X unwrap(URL value, Class<X> type, WrapperOptions options) {
		if ( value == null ) {
			return null; 
		} 
		if ( String.class.isAssignableFrom( type ) ) {
			return (X) toString( value );
		} 
		throw unknownUnwrap( type );
	}