Tabnine Logo
StringType.nullSafeSet
Code IndexAdd Tabnine to your IDE (free)

How to use
nullSafeSet
method
in
org.hibernate.type.StringType

Best Java code snippets using org.hibernate.type.StringType.nullSafeSet (Showing top 19 results out of 315)

origin: hibernate/hibernate-orm

public void nullSafeSet(PreparedStatement st, Object value, int index, SharedSessionContractImplementor session)
    throws HibernateException, SQLException {
  String[] strings = ( value == null ) ? new String[2] : (String[]) value;
  StringType.INSTANCE.nullSafeSet( st, strings[0], index, session );
  StringType.INSTANCE.nullSafeSet( st, strings[1], index + 1, session );
}
origin: hibernate/hibernate-orm

public void nullSafeSet(PreparedStatement st, Object value, int index, SharedSessionContractImplementor session)
    throws HibernateException, SQLException {
  if ( value != null ) {
    String v = (String) value;
    if ( !v.startsWith( param1 ) ) {
      v = param1 + v;
    }
    if ( !v.endsWith( param2 ) ) {
      v = v + param2;
    }
    StringType.INSTANCE.nullSafeSet( st, v, index, session );
  }
  else {
    StringType.INSTANCE.nullSafeSet( st, null, index, session );
  }
}
origin: pl.edu.icm.sedno/sedno-tools

@Override
public void nullSafeSet(PreparedStatement st, Object value, int index, SessionImplementor session) throws HibernateException, SQLException {
  
  String classNameToPersist = null;
  if ( value != null) {        	
    classNameToPersist = ((Class)value).getName();
  }            
  
  StringType.INSTANCE.nullSafeSet(st, classNameToPersist, index, session);       
}
origin: ezbz/projectx

/**
 * Convert a URI to a string
 */
@Override
public void nullSafeSet(final PreparedStatement st, final Object value, final int index)
  throws HibernateException, SQLException {
 StandardBasicTypes.STRING.nullSafeSet(st, ((URI) value).toString(), index);
}
origin: hibernate/hibernate-search

@Override
public void nullSafeSet(PreparedStatement st, Object value, int index, SharedSessionContractImplementor session)
    throws HibernateException, SQLException {
  if ( value == null ) {
    delegateType.nullSafeSet( st, null, index, session );
  }
  else {
    delegateType.nullSafeSet( st, ( (ISBN) value ).getStringValue(), index, session );
  }
}
origin: joda-time/joda-time-hibernate

public void nullSafeSet(PreparedStatement preparedStatement, Object value, int index) throws HibernateException, SQLException {
  if (value == null) {
    StandardBasicTypes.STRING.nullSafeSet(preparedStatement, null, index);
  } else {
    LocalTime lt = ((LocalTime) value);
    StandardBasicTypes.STRING.nullSafeSet(preparedStatement, lt.toString(), index);
  }
}
origin: JodaOrg/joda-time-hibernate

public void nullSafeSet(PreparedStatement preparedStatement, Object value, int index) throws HibernateException, SQLException {
  if (value == null) {
    StandardBasicTypes.STRING.nullSafeSet(preparedStatement, null, index);
  } else {
    StandardBasicTypes.STRING.nullSafeSet(preparedStatement, toNonNullString(value), index);
  }
}
origin: joda-time/joda-time-hibernate

public void nullSafeSet(PreparedStatement preparedStatement, Object value, int index) throws HibernateException, SQLException {
  if (value == null) {
    StandardBasicTypes.STRING.nullSafeSet(preparedStatement, null, index);
  } else {
    StandardBasicTypes.STRING.nullSafeSet(preparedStatement, toNonNullString(value), index);
  }
}
origin: JodaOrg/joda-time-hibernate

public void nullSafeSet(PreparedStatement preparedStatement, Object value, int index) throws HibernateException, SQLException {
  if (value == null) {
    StandardBasicTypes.STRING.nullSafeSet(preparedStatement, null, index);
  } else {
    LocalTime lt = ((LocalTime) value);
    StandardBasicTypes.STRING.nullSafeSet(preparedStatement, lt.toString(), index);
  }
}
origin: OpenNMS/opennms

@Override
public void nullSafeSet(final PreparedStatement st, final Object value, final int index) throws HibernateException, SQLException {
  if (value == null) {
    StringType.INSTANCE.nullSafeSet(st, null, index);
  } else if (value instanceof InetAddress){
    // Format the IP address into a uniform format
    StringType.INSTANCE.nullSafeSet(st, InetAddressUtils.str((InetAddress)value), index);
  } else if (value instanceof String){
    try {
      // Format the IP address into a uniform format
      StringType.INSTANCE.nullSafeSet(st, InetAddressUtils.normalize((String)value), index);
    } catch (final IllegalArgumentException e) {
      // If the argument is not a valid IP address, then just pass it as-is. This
      // can occur of the query is performing a LIKE query (ie. '192.168.%').
      //
      // TODO: Add more validation of this string
      //
      StringType.INSTANCE.nullSafeSet(st, (String)value, index);
    }
  }
}
origin: Evolveum/midpoint

@Override
public void nullSafeSet(PreparedStatement st, Object value, int index, SharedSessionContractImplementor session)
    throws HibernateException, SQLException {
  if (isOracle(session) && value != null) {
    value = '\u0000' + ((String) value);
  }
  StringType.INSTANCE.nullSafeSet(st, value, index, session);
}
origin: pentaho/pentaho-platform

public void nullSafeSet( final PreparedStatement arg0, final Object arg1, final int arg2 ) throws HibernateException,
 SQLException {
 // If this is an empty string, write _PENTAHOEMPTY_ into the database.
 if ( EmptyStringUserType.debug ) {
  EmptyStringUserType.log.debug( Messages.getInstance().getString( "EMPTYSTRTYPE.DEBUG_NULL_SAFE_SET" ) ); //$NON-NLS-1$
 }
 Hibernate.STRING.nullSafeSet( arg0, ( arg1 != null ) ? ( ( ( (String) arg1 ).length() > 0 ) ? arg1
   : EmptyStringUserType.PENTAHOEMPTY ) : arg1, arg2, null );
}
origin: debop/hibernate-redis

@Override
public void nullSafeSet(PreparedStatement st, Object value, int index, SharedSessionContractImplementor sharedSessionContractImplementor) throws HibernateException, SQLException {
 DateTime dt = (DateTime) value;
 if (dt == null) {
  StandardBasicTypes.TIMESTAMP.nullSafeSet(st, null, index, sharedSessionContractImplementor);
  StandardBasicTypes.STRING.nullSafeSet(st, null, index + 1, sharedSessionContractImplementor);
 } else {
  StandardBasicTypes.TIMESTAMP.nullSafeSet(st, dt.toDate(), index, sharedSessionContractImplementor);
  StandardBasicTypes.STRING.nullSafeSet(st, dt.getZone().getID(), index + 1, sharedSessionContractImplementor);
 }
}
origin: joda-time/joda-time-hibernate

public void nullSafeSet(PreparedStatement preparedStatement, Object value, int index) throws HibernateException, SQLException {
  if (value == null) {
    StandardBasicTypes.TIMESTAMP.nullSafeSet(preparedStatement, null, index);
    StandardBasicTypes.STRING.nullSafeSet(preparedStatement, null, index + 1);
  } else {
    DateTime dt = (DateTime) value;
    StandardBasicTypes.TIMESTAMP.nullSafeSet(preparedStatement, dt.toDate(), index);
    StandardBasicTypes.STRING.nullSafeSet(preparedStatement, dt.getZone().getID(), index + 1);
  }
}
origin: JodaOrg/joda-time-hibernate

public void nullSafeSet(PreparedStatement preparedStatement, Object value, int index) throws HibernateException, SQLException {
  if (value == null) {
    StandardBasicTypes.TIMESTAMP.nullSafeSet(preparedStatement, null, index);
    StandardBasicTypes.STRING.nullSafeSet(preparedStatement, null, index + 1);
  } else {
    DateTime dt = (DateTime) value;
    StandardBasicTypes.TIMESTAMP.nullSafeSet(preparedStatement, dt.toDate(), index);
    StandardBasicTypes.STRING.nullSafeSet(preparedStatement, dt.getZone().getID(), index + 1);
  }
}
origin: pl.edu.icm.sedno/sedno-tools

@Override
public void nullSafeSet(PreparedStatement st, Object value, int index, SessionImplementor session) throws HibernateException, SQLException {
  
  String stringPersist = null;
  if ( value != null && !isNullify(value)) {
    stringPersist = writeToDatabase(value);
  }            
  
  StringType.INSTANCE.nullSafeSet(st, stringPersist, index, session);       
}    
origin: riotfamily/riot

public void nullSafeSet(PreparedStatement st, Object value,	int index, boolean[] settable, SessionImplementor session)
throws HibernateException, SQLException {
  Serializable id;
  String entityName;
  if (value==null) {
    id=null;
    entityName=null;
  }
  else {
    entityName = session.bestGuessEntityName(value);
    id = ForeignKeys.getEntityIdentifierIfNotUnsaved(entityName, value, session);
  }
  
  if ( settable==null || settable[0] ) {
    StandardBasicTypes.STRING.nullSafeSet(st, entityName, index, session);
  }
  String s = idToString(entityName, id, session);
  if (settable == null) {
    StandardBasicTypes.STRING.nullSafeSet(st, s, index + 1, session);
  }
  else {
    boolean[] idsettable = new boolean[settable.length - 1];
    System.arraycopy(settable, 1, idsettable, 0, idsettable.length);
    StandardBasicTypes.STRING.nullSafeSet(st, s, index + 1, idsettable, session);
  }
}
origin: OpenNMS/opennms

@Override
public void nullSafeSet(final PreparedStatement st, final Object value, final int index) throws HibernateException, SQLException {
  if (value == null) {
    StringType.INSTANCE.nullSafeSet(st, null, index);
  } else if (value instanceof NodeLabelSource){
    CharacterType.INSTANCE.nullSafeSet(st, ((NodeLabelSource)value).toString().charAt(0), index);
  } else if (value instanceof String){
    for (NodeLabelSource type : NodeLabelSource.values()) {
      if (type.toString().equals(value)) {
        CharacterType.INSTANCE.nullSafeSet(st, type.toString().charAt(0), index);
      }
    }
  }
}
origin: OpenNMS/opennms

@Override
public void nullSafeSet(final PreparedStatement st, final Object value, final int index) throws HibernateException, SQLException {
  if (value == null) {
    StringType.INSTANCE.nullSafeSet(st, null, index);
  } else if (value instanceof NodeType){
    CharacterType.INSTANCE.nullSafeSet(st, ((NodeType)value).toString().charAt(0), index);
  } else if (value instanceof String){
    for (NodeType type : NodeType.values()) {
      if (type.toString().equals(value)) {
        CharacterType.INSTANCE.nullSafeSet(st, type.toString().charAt(0), index);
      }
    }
  }
}
org.hibernate.typeStringTypenullSafeSet

Popular methods of StringType

  • nullSafeGet
  • sqlType
  • getName
  • <init>
  • objectToSQLString
  • set
  • get
  • getJavaTypeDescriptor
  • getSqlTypeDescriptor
  • stringToObject
  • toString
  • toString

Popular in Java

  • Start an intent from android
  • addToBackStack (FragmentTransaction)
  • setScale (BigDecimal)
  • notifyDataSetChanged (ArrayAdapter)
  • Menu (java.awt)
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • Format (java.text)
    The base class for all formats. This is an abstract base class which specifies the protocol for clas
  • Arrays (java.util)
    This class contains various methods for manipulating arrays (such as sorting and searching). This cl
  • StringTokenizer (java.util)
    Breaks a string into tokens; new code should probably use String#split.> // Legacy code: StringTo
  • JButton (javax.swing)
  • Best plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now