org.hibernate.Hibernate.getLobCreator()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(5.9k)|赞(0)|评价(0)|浏览(304)

本文整理了Java中org.hibernate.Hibernate.getLobCreator()方法的一些代码示例,展示了Hibernate.getLobCreator()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Hibernate.getLobCreator()方法的具体详情如下:
包路径:org.hibernate.Hibernate
类名称:Hibernate
方法名:getLobCreator

Hibernate.getLobCreator介绍

[英]Obtain a lob creator for the given session.
[中]

代码示例

代码示例来源:origin: hibernate/hibernate-orm

@Override
public LobCreator getLobCreator() {
  return Hibernate.getLobCreator( this );
}

代码示例来源:origin: hibernate/hibernate-orm

/**
 * Obtain a lob creator for the given session.
 *
 * @param session The session for which to obtain a lob creator
 *
 * @return The log creator reference
 */
public static LobCreator getLobCreator(Session session) {
  return getLobCreator( (SessionImplementor) session );
}

代码示例来源:origin: hibernate/hibernate-orm

@Test
public void testLobCreation() throws SQLException {
  Session session = sessionFactory().getCurrentSession();
  session.beginTransaction();
  Blob blob = Hibernate.getLobCreator( session ).createBlob( new byte[] {} );
  blob.free();
  Clob clob = Hibernate.getLobCreator( session ).createClob( "Steve" );
  clob.free();
  session.getTransaction().commit();
  assertFalse( session.isOpen() );
}

代码示例来源:origin: org.hibernate/hibernate-annotations

protected void set(PreparedStatement st, Object value, int index, SessionImplementor session) throws SQLException {
  if ( value == null ) {
    st.setNull( index, sqlTypes( null )[0] );
  }
  else {
    byte[] toSet = unWrap( value );
    final boolean useInputStream = session.getFactory().getDialect().useInputStreamToInsertBlob();
    if ( useInputStream ) {
      st.setBinaryStream( index, new ByteArrayInputStream( toSet ), toSet.length );
    }
    else {
      st.setBlob( index, Hibernate.getLobCreator( session ).createBlob( toSet ) );
    }
  }
}

代码示例来源:origin: org.hibernate/hibernate-annotations

public void set(PreparedStatement st, Object value, int index, SessionImplementor session) throws SQLException {
  if ( value != null ) {
    byte[] toSet;
    toSet = toBytes( value );
    if ( session.getFactory().getDialect().useInputStreamToInsertBlob() ) {
      st.setBinaryStream( index, new ByteArrayInputStream( toSet ), toSet.length );
    }
    else {
      st.setBlob( index, Hibernate.getLobCreator( session ).createBlob( toSet ) );
    }
  }
  else {
    st.setNull( index, sqlTypes( null )[0] );
  }
}

代码示例来源:origin: org.hibernate.orm/hibernate-core

/**
 * Obtain a lob creator for the given session.
 *
 * @param session The session for which to obtain a lob creator
 *
 * @return The log creator reference
 */
public static LobCreator getLobCreator(Session session) {
  return getLobCreator( (SessionImplementor) session );
}

代码示例来源:origin: org.hibernate.orm/hibernate-core

@Override
public LobCreator getLobCreator() {
  return Hibernate.getLobCreator( this );
}

代码示例来源:origin: org.hibernate/com.springsource.org.hibernate

public static LobCreator getLobCreator(Session session) {
  return getLobCreator( (SessionImplementor) session );
}

代码示例来源:origin: org.hibernate/com.springsource.org.hibernate.core

public LobCreator getLobCreator() {
  return Hibernate.getLobCreator( session );
}

代码示例来源:origin: org.hibernate/com.springsource.org.hibernate.core

public LobCreator getLobCreator() {
  return Hibernate.getLobCreator( session );
}

代码示例来源:origin: org.hibernate/com.springsource.org.hibernate

public LobCreator getLobCreator() {
  return Hibernate.getLobCreator( session );
}

代码示例来源:origin: org.hibernate/com.springsource.org.hibernate

public LobCreator getLobCreator() {
  return Hibernate.getLobCreator( session );
}

代码示例来源:origin: org.hibernate/com.springsource.org.hibernate.core

public static LobCreator getLobCreator(Session session) {
  return getLobCreator( (SessionImplementor) session );
}

代码示例来源:origin: org.beangle.commons/beangle-commons-orm

public Blob createBlob(InputStream inputStream) {
 try {
  ByteArrayOutputStream buffer = new ByteArrayOutputStream(inputStream.available());
  StreamUtils.copy(inputStream, buffer);
  return Hibernate.getLobCreator(getSession()).createBlob(buffer.toByteArray());
 } catch (Exception e) {
  throw new RuntimeException(e);
 }
}

代码示例来源:origin: org.beangle.commons/beangle-commons-orm

public Blob createBlob(InputStream inputStream, int length) {
 return Hibernate.getLobCreator(getSession()).createBlob(inputStream, length);
}

代码示例来源:origin: org.beangle.commons/beangle-commons-orm

public Clob createClob(String str) {
 return Hibernate.getLobCreator(getSession()).createClob(str);
}

代码示例来源:origin: org.hibernate/com.springsource.org.hibernate.core

public void set(PreparedStatement st, Object value, int index, SessionImplementor session) throws SQLException {
  if ( value != null ) {
    byte[] toSet;
    toSet = toBytes( value );
    if ( session.getFactory().getDialect().useInputStreamToInsertBlob() ) {
      st.setBinaryStream( index, new ByteArrayInputStream( toSet ), toSet.length );
    }
    else {
      st.setBlob( index, Hibernate.getLobCreator( session ).createBlob( toSet ) );
    }
  }
  else {
    st.setNull( index, sqlTypes( null )[0] );
  }
}

代码示例来源:origin: org.hibernate/com.springsource.org.hibernate.core

protected void set(PreparedStatement st, Object value, int index, SessionImplementor session) throws SQLException {
  if ( value == null ) {
    st.setNull( index, sqlTypes( null )[0] );
  }
  else {
    byte[] toSet = unWrap( value );
    final boolean useInputStream = session.getFactory().getDialect().useInputStreamToInsertBlob();
    if ( useInputStream ) {
      st.setBinaryStream( index, new ByteArrayInputStream( toSet ), toSet.length );
    }
    else {
      st.setBlob( index, Hibernate.getLobCreator( session ).createBlob( toSet ) );
    }
  }
}

代码示例来源:origin: org.hibernate/com.springsource.org.hibernate

public void set(PreparedStatement st, Object value, int index, SessionImplementor session) throws SQLException {
  if ( value != null ) {
    byte[] toSet;
    toSet = toBytes( value );
    if ( session.getFactory().getDialect().useInputStreamToInsertBlob() ) {
      st.setBinaryStream( index, new ByteArrayInputStream( toSet ), toSet.length );
    }
    else {
      st.setBlob( index, Hibernate.getLobCreator( session ).createBlob( toSet ) );
    }
  }
  else {
    st.setNull( index, sqlTypes( null )[0] );
  }
}

代码示例来源:origin: org.hibernate/com.springsource.org.hibernate

protected void set(PreparedStatement st, Object value, int index, SessionImplementor session) throws SQLException {
  if ( value == null ) {
    st.setNull( index, sqlTypes( null )[0] );
  }
  else {
    byte[] toSet = unWrap( value );
    final boolean useInputStream = session.getFactory().getDialect().useInputStreamToInsertBlob();
    if ( useInputStream ) {
      st.setBinaryStream( index, new ByteArrayInputStream( toSet ), toSet.length );
    }
    else {
      st.setBlob( index, Hibernate.getLobCreator( session ).createBlob( toSet ) );
    }
  }
}

相关文章