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

How to use
StringType
in
org.hibernate.type

Best Java code snippets using org.hibernate.type.StringType (Showing top 20 results out of 369)

origin: hibernate/hibernate-orm

public Object nullSafeGet(ResultSet rs, String[] names, SharedSessionContractImplementor session, Object owner)
    throws HibernateException, SQLException {
  String first = StringType.INSTANCE.nullSafeGet( rs, names[0], session );
  String second = StringType.INSTANCE.nullSafeGet( rs, names[1], session );
  return ( first == null && second == null ) ? null : new String[] {first, second};
}
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

@Override
public int[] sqlTypes() {
  return new int[] {StringType.INSTANCE.sqlType()};
}
origin: hibernate/hibernate-orm

  @Override
  public String objectToSQLString(Boolean value, Dialect dialect) throws Exception {
    return StringType.INSTANCE.objectToSQLString( value ? "Y" : "N", dialect );
  }
}
origin: gocd/gocd

addEntity("mods", Modification.class).
addScalar("pmrPipelineId", new LongType()).
addScalar("pmrPipelineName", new StringType()).
addScalar("materialType", new StringType()).
addScalar("fingerprint", new StringType()).
setParameterList("ids", CollectionUtil.map(relevantToLookedUpMap.keySet(), PipelineId.MAP_ID)).
list();
origin: hibernate/hibernate-orm

public String getName() {
  return StringType.INSTANCE.getName();
}
origin: bonitasoft/bonita-engine

@Override
public void nullSafeSet(final PreparedStatement st, final Object value, final int index, final SessionImplementor session) throws HibernateException {
  try {
    if (value == null) {
      st.setNull(index, type.sqlType());
    } else {
      final String identifier = (String) identifierMethod.invoke(value, new Object[0]);
      type.set(st, identifier, index, session);
    }
  } catch (final Exception e) {
    final StringBuilder stb = new StringBuilder("Exception while invoking identifierMethod '");
    stb.append(valueOfMethod.getName());
    stb.append("' of enumeration class '");
    stb.append(enumClass);
    stb.append('\'');
    throw new HibernateException(stb.toString(), e);
  }
}
origin: mkuthan/example-spring

@SuppressWarnings("rawtypes")
@Override
public void nullSafeSet(PreparedStatement st, Object value, int index, SessionImplementor session)
    throws HibernateException, SQLException {
  JsonHolder jsonHolder = (JsonHolder) value;
  if (jsonHolder != null && jsonHolder.getValue() != null) {
    StringType.INSTANCE.set(st, jsonHolder.getValue().getClass().getName(), index, session);
    TextType.INSTANCE.set(st, jsonSerializationService.toJson(jsonHolder.getValue()), index + 1, session);
  } else {
    StringType.INSTANCE.set(st, null, index, session);
    TextType.INSTANCE.set(st, null, index + 1, session);
  }
}
origin: hibernate/hibernate-orm

@Override
public String objectToSQLString(Boolean value, Dialect dialect) throws Exception {
  return StringType.INSTANCE.objectToSQLString( value ? "T" : "F", dialect );
}
origin: gocd/gocd

private Map<PipelineId, Set<Long>> relevantToLookedUpDependencyMap(Session session, List<Long> pipelineIds) {
  final int LOOKED_UP_PIPELINE_ID = 2;
  final int RELEVANT_PIPELINE_ID = 0;
  final int RELEVANT_PIPELINE_NAME = 1;
  String pipelineIdsSql = queryExtensions.queryRelevantToLookedUpDependencyMap(pipelineIds);
  SQLQuery pipelineIdsQuery = session.createSQLQuery(pipelineIdsSql);
  pipelineIdsQuery.addScalar("id", new LongType());
  pipelineIdsQuery.addScalar("name", new StringType());
  pipelineIdsQuery.addScalar("lookedUpId", new LongType());
  final List<Object[]> ids = pipelineIdsQuery.list();
  Map<Long, List<PipelineId>> lookedUpToParentMap = new HashMap<>();
  CollectionUtil.CollectionValueMap<Long, PipelineId> lookedUpToRelevantMap = CollectionUtil.collectionValMap(lookedUpToParentMap, new CollectionUtil.ArrayList<>());
  for (Object[] relevantAndLookedUpId : ids) {
    lookedUpToRelevantMap.put((Long) relevantAndLookedUpId[LOOKED_UP_PIPELINE_ID],
        new PipelineId((String) relevantAndLookedUpId[RELEVANT_PIPELINE_NAME], (Long) relevantAndLookedUpId[RELEVANT_PIPELINE_ID]));
  }
  return CollectionUtil.reverse(lookedUpToParentMap);
}
origin: hibernate/hibernate-orm

registerHibernateType( Types.CHAR, StandardBasicTypes.CHARACTER.getName() );
registerHibernateType( Types.CHAR, 1, StandardBasicTypes.CHARACTER.getName() );
registerHibernateType( Types.CHAR, 255, StandardBasicTypes.STRING.getName() );
registerHibernateType( Types.DATE, StandardBasicTypes.DATE.getName() );
registerHibernateType( Types.DOUBLE, StandardBasicTypes.DOUBLE.getName() );
registerHibernateType( Types.TIME, StandardBasicTypes.TIME.getName() );
registerHibernateType( Types.TIMESTAMP, StandardBasicTypes.TIMESTAMP.getName() );
registerHibernateType( Types.VARCHAR, StandardBasicTypes.STRING.getName() );
registerHibernateType( Types.NVARCHAR, StandardBasicTypes.NSTRING.getName() );
registerHibernateType( Types.VARBINARY, StandardBasicTypes.BINARY.getName() );
origin: bonitasoft/bonita-engine

@Override
public void nullSafeSet(final PreparedStatement st, final Object value, final int index, final SessionImplementor session) throws HibernateException {
  try {
    if (value == null) {
      st.setNull(index, type.sqlType());
    } else {
      final String identifier = (String) identifierMethod.invoke(value, new Object[0]);
      type.set(st, identifier, index, session);
    }
  } catch (final Exception e) {
    final StringBuilder stb = new StringBuilder("Exception while invoking identifierMethod '");
    stb.append(valueOfMethod.getName());
    stb.append("' of enumeration class '");
    stb.append(enumClass);
    stb.append('\'');
    throw new HibernateException(stb.toString(), e);
  }
}
origin: mkuthan/example-spring

@Override
public void nullSafeSet(PreparedStatement st, Object value, int index, SessionImplementor session)
    throws HibernateException, SQLException {
  if (value == null) {
    BigDecimalType.INSTANCE.set(st, null, index, session);
    StringType.INSTANCE.set(st, null, index + 1, session);
  } else {
    Money money = (Money) value;
    BigDecimalType.INSTANCE.set(st, money.getAmount(), index, session);
    StringType.INSTANCE.set(st, money.getCurrencyUnit().getCurrencyCode(), index + 1, session);
  }
}
origin: hibernate/hibernate-orm

public Object nullSafeGet(ResultSet rs, String[] names, SharedSessionContractImplementor session, Object owner)
    throws HibernateException, SQLException {
  return StringType.INSTANCE.nullSafeGet( rs, names[0], 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: hibernate/hibernate-orm

public void nullSafeSet(
    final PreparedStatement st, final Object value,
    final int index, final SharedSessionContractImplementor session)
    throws HibernateException, SQLException {
  if ( value == null ) {
    st.setNull( index, StringType.INSTANCE.sqlType() );
    st.setNull( index + 1, IntegerType.INSTANCE.sqlType() );
  }
  else {
    final Component comp = (Component) value;
    st.setString( index, comp.getProp1() );
    st.setInt( index + 1, comp.getProp2() );
  }
}
origin: hibernate/hibernate-orm

  public String objectToSQLString(UUID value, Dialect dialect) throws Exception {
    return StringType.INSTANCE.objectToSQLString( value.toString(), dialect );
  }
}
origin: stackoverflow.com

 public List<MessageExtDto> getMessagesForProfile2(Long userProfileId) {
  Query query = getSession().createSQLQuery("  "
      + " select a.*, b.* "
      + " from messageVO AS a "
      + " INNER JOIN ( SELECT max(id) AS id, count(*) AS count FROM messageVO GROUP BY messageConversation_id) as b ON a.id = b.id "
      + " where a.id > 0 "
      + " ")
      .addScalar("id", new LongType())
      .addScalar("message", new StringType())
      ......... your mappings
      .setResultTransformer(Transformers.aliasToBean(MessageExtDto.class));

  List<MessageExtDto> list = query.list();
  return list;
}
origin: hibernate/hibernate-orm

registerHibernateType( Types.CLOB, StandardBasicTypes.MATERIALIZED_CLOB.getName() );
registerHibernateType( Types.BLOB, StandardBasicTypes.MATERIALIZED_BLOB.getName() );
registerHibernateType( Types.NVARCHAR, StandardBasicTypes.STRING.getName() );
origin: org.ow2.bonita/bonita-server

@Override
public void nullSafeSet(final PreparedStatement st, final Object value, final int index) throws SQLException {
 try {
  if (value == null) {
   st.setNull(index, type.sqlType());
  } else {
   final String identifier = (String) identifierMethod.invoke(value, new Object[0]);
   type.set(st, identifier, index);
  }
 } catch (final Exception e) {
  final String message = ExceptionManager.getInstance().getFullMessage("bh_GEUT_6", identifierMethod.getName(),
    enumClass);
  throw new HibernateException(message, e);
 }
}
org.hibernate.typeStringType

Javadoc

A type that maps between java.sql.Types#VARCHAR and String

Most used methods

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

Popular in Java

  • Creating JSON documents from java classes using gson
  • scheduleAtFixedRate (Timer)
  • notifyDataSetChanged (ArrayAdapter)
  • setScale (BigDecimal)
  • String (java.lang)
  • System (java.lang)
    Provides access to system-related information and resources including standard input and output. Ena
  • ByteBuffer (java.nio)
    A buffer for bytes. A byte buffer can be created in either one of the following ways: * #allocate
  • Hashtable (java.util)
    A plug-in replacement for JDK1.5 java.util.Hashtable. This version is based on org.cliffc.high_scale
  • Annotation (javassist.bytecode.annotation)
    The annotation structure.An instance of this class is returned bygetAnnotations() in AnnotationsAttr
  • JOptionPane (javax.swing)
  • CodeWhisperer alternatives
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