@Override public Comparator getComparator() { return (Comparator) getUserType(); }
public BasicTypeRegistration(UserType type, String[] keys) { this( new CustomType( type, keys ), keys ); }
@Override public Object nullSafeGet( ResultSet rs, String columnName, SharedSessionContractImplementor session, Object owner) throws SQLException { return nullSafeGet(rs, new String[] { columnName }, session, owner); }
@Override public Object extract(CallableStatement statement, int startIndex, SharedSessionContractImplementor session) throws SQLException { if ( canDoExtraction() ) { return ((ProcedureParameterExtractionAware) getUserType() ).extract( statement, startIndex, session ); } else { throw new UnsupportedOperationException( "Type [" + getUserType() + "] does support parameter value extraction" ); } }
@Override public void nullSafeSet( CallableStatement statement, Object value, String name, SharedSessionContractImplementor session) throws SQLException { if ( canDoSetting() ) { ((ProcedureParameterNamedBinder) getUserType() ).nullSafeSet( statement, value, name, session ); } else { throw new UnsupportedOperationException( "Type [" + getUserType() + "] does support parameter binding by name" ); } }
@Override public String toLoggableString(Object value, SessionFactoryImplementor factory) throws HibernateException { if ( value == null ) { return "null"; } else if ( customLogging ) { return ( ( LoggableUserType ) getUserType() ).toLoggableString( value, factory ); } else { return toXMLString( value, factory ); } }
public String toLoggableString(Object value, SessionFactoryImplementor factory) throws HibernateException { if ( value == null ) { return "null"; } else if ( customLogging ) { return ( ( LoggableUserType ) userType ).toLoggableString( value, factory ); } else { return toXMLString( value, factory ); } }
public Object nullSafeGet(ResultSet rs, String columnName, SessionImplementor session, Object owner) throws HibernateException, SQLException { return nullSafeGet(rs, new String[] { columnName }, session, owner); }
@Controller class MyController { public ModelAndView processSubmittedForm(@Valid MyObject myObject, BindingResult result) {..} @InitBinder public void initBinder (WebDataBinder binder) { binder.registerCustomEditor(MyObject.class, new CustomObjectEditor()); } } class CustomObjectEditor { @Override public void setAsText(String text) throws IllegalArgumentException { MyObject ob = new MyObject(); CustomType ct = new CustomType(); ct.setValue(text); ob.setCustomType(ct); super.setValue(ob); } }
@Override public boolean isDirty(Object old, Object current, boolean[] checkable, SharedSessionContractImplementor session) throws HibernateException { return checkable[0] && isDirty(old, current, session); }
@Override public boolean[] toColumnNullness(Object value, Mapping mapping) { boolean[] result = new boolean[ getColumnSpan(mapping) ]; if ( value != null ) { Arrays.fill(result, true); } return result; }
public Object fromXMLNode(Node xml, Mapping factory) throws HibernateException { return fromXMLString( xml.getText(), factory ); }
@Override public Object extract(CallableStatement statement, String[] paramNames, SharedSessionContractImplementor session) throws SQLException { if ( canDoExtraction() ) { return ((ProcedureParameterExtractionAware) getUserType() ).extract( statement, paramNames, session ); } else { throw new UnsupportedOperationException( "Type [" + getUserType() + "] does support parameter value extraction" ); } }
public String toLoggableString(Object value, SessionFactoryImplementor factory) throws HibernateException { return value==null ? "null" : toXMLString(value, factory); } }
public Object nullSafeGet(ResultSet rs, String columnName, SessionImplementor session, Object owner) throws HibernateException, SQLException { return nullSafeGet(rs, new String[] { columnName }, session, owner); }
public boolean isDirty(Object old, Object current, boolean[] checkable, SessionImplementor session) throws HibernateException { return checkable[0] && isDirty(old, current, session); } }
public boolean[] toColumnNullness(Object value, Mapping mapping) { boolean[] result = new boolean[ getColumnSpan(mapping) ]; if (value!=null) Arrays.fill(result, true); return result; }
public Object fromXMLNode(Node xml, Mapping factory) throws HibernateException { return fromXMLString( xml.getText(), factory ); }
@Override public boolean equals(Object obj) { return ( obj instanceof CustomType ) && getUserType().equals( ( (CustomType) obj ).getUserType() ); } }
public Configuration registerTypeOverride(UserType type, String[] keys) { basicTypes.add( new CustomType( type, keys ) ); return this; }