Examples of LobCreator


Examples of org.springframework.jdbc.support.lob.LobCreator

    if (this.lobHandler == null) {
      throw new IllegalStateException("No LobHandler found for configuration - " +
          "lobHandler property must be set on LocalSessionFactoryBean");
    }

    LobCreator lobCreator = this.lobHandler.getLobCreator();
    try {
      nullSafeSetInternal(st, index, value, lobCreator);
    }
    catch (IOException ex) {
      throw new HibernateException("I/O errors during LOB access", ex);
View Full Code Here

Examples of org.springframework.jdbc.support.lob.LobCreator

  public AbstractLobCreatingPreparedStatementCallback(LobHandler lobHandler) {
    this.lobHandler = lobHandler;
  }

  public final Object doInPreparedStatement(PreparedStatement ps) throws SQLException, DataAccessException {
    LobCreator lobCreator = this.lobHandler.getLobCreator();
    try {
      setValues(ps, lobCreator);
      return new Integer(ps.executeUpdate());
    }
    finally {
      lobCreator.close();
    }
  }
View Full Code Here

Examples of org.springframework.jdbc.support.lob.LobCreator

    if (this.lobHandler == null) {
      throw new IllegalStateException("No LobHandler found for configuration - " +
          "lobHandler property must be set on LocalSessionFactoryBean");
    }

    LobCreator lobCreator = this.lobHandler.getLobCreator();
    try {
      nullSafeSetInternal(st, index, value, lobCreator);
    }
    catch (IOException ex) {
      throw new HibernateException("I/O errors during LOB access", ex);
View Full Code Here

Examples of org.springframework.jdbc.support.lob.LobCreator

    if (!TransactionSynchronizationManager.isSynchronizationActive()) {
      throw new IllegalStateException("Spring transaction synchronization needs to be active for " +
          "setting values in iBATIS TypeHandlers that delegate to a Spring LobHandler");
    }
    final LobCreator lobCreator = this.lobHandler.getLobCreator();
    try {
      setParameterInternal(ps, i, parameter, jdbcType, lobCreator);
    }
    catch (IOException ex) {
      throw new SQLException("I/O errors during LOB access: " + ex.getMessage());
View Full Code Here

Examples of org.springframework.jdbc.support.lob.LobCreator

    lobHandler.getClobAsCharacterStream(rs, 1);
    rsControl.verify();
  }

  public void testSetBlobAsBytes() throws SQLException {
    LobCreator lobCreator = (new DefaultLobHandler()).getLobCreator();
    byte[] content = "testContent".getBytes();

    MockControl psControl = MockControl.createControl(PreparedStatement.class);
    PreparedStatement ps = (PreparedStatement) psControl.getMock();
    ps.setBytes(1, content);
    psControl.replay();

    lobCreator.setBlobAsBytes(ps, 1, content);
    psControl.verify();
  }
View Full Code Here

Examples of org.springframework.jdbc.support.lob.LobCreator

    lobCreator.setBlobAsBytes(ps, 1, content);
    psControl.verify();
  }

  public void testSetBlobAsBinaryStream() throws SQLException, IOException {
    LobCreator lobCreator = (new DefaultLobHandler()).getLobCreator();
    InputStream bis = new ByteArrayInputStream("testContent".getBytes());

    MockControl psControl = MockControl.createControl(PreparedStatement.class);
    PreparedStatement ps = (PreparedStatement) psControl.getMock();
    ps.setBinaryStream(1, bis, 11);
    psControl.replay();

    lobCreator.setBlobAsBinaryStream(ps, 1, bis, 11);
    psControl.verify();
  }
View Full Code Here

Examples of org.springframework.jdbc.support.lob.LobCreator

    lobCreator.setBlobAsBinaryStream(ps, 1, bis, 11);
    psControl.verify();
  }

  public void testSetClobAsString() throws SQLException, IOException {
    LobCreator lobCreator = (new DefaultLobHandler()).getLobCreator();
    String content = "testContent";

    MockControl psControl = MockControl.createControl(PreparedStatement.class);
    PreparedStatement ps = (PreparedStatement) psControl.getMock();
    ps.setString(1, content);
    psControl.replay();

    lobCreator.setClobAsString(ps, 1, content);
    psControl.verify();
  }
View Full Code Here

Examples of org.springframework.jdbc.support.lob.LobCreator

    lobCreator.setClobAsString(ps, 1, content);
    psControl.verify();
  }

  public void testSetClobAsAsciiStream() throws SQLException, IOException {
    LobCreator lobCreator = (new DefaultLobHandler()).getLobCreator();
    InputStream bis = new ByteArrayInputStream("testContent".getBytes());

    MockControl psControl = MockControl.createControl(PreparedStatement.class);
    PreparedStatement ps = (PreparedStatement) psControl.getMock();
    ps.setAsciiStream(1, bis, 11);
    psControl.replay();

    lobCreator.setClobAsAsciiStream(ps, 1, bis, 11);
    psControl.verify();
  }
View Full Code Here

Examples of org.springframework.jdbc.support.lob.LobCreator

    lobCreator.setClobAsAsciiStream(ps, 1, bis, 11);
    psControl.verify();
  }

  public void testSetClobAsCharacterStream() throws SQLException, IOException {
    LobCreator lobCreator = (new DefaultLobHandler()).getLobCreator();
    Reader str = new StringReader("testContent");

    MockControl psControl = MockControl.createControl(PreparedStatement.class);
    PreparedStatement ps = (PreparedStatement) psControl.getMock();
    ps.setCharacterStream(1, str, 11);
    psControl.replay();

    lobCreator.setClobAsCharacterStream(ps, 1, str, 11);
    psControl.verify();
  }
View Full Code Here

Examples of org.springframework.jdbc.support.lob.LobCreator

   
    MockControl lobHandlerControl = MockControl.createControl(LobHandler.class);
    LobHandler handler = (LobHandler)lobHandlerControl.getMock();   
   
    MockControl lobCreatorControl = MockControl.createControl(LobCreator.class);
    LobCreator creator = (LobCreator)lobCreatorControl.getMock();
   
    MockControl psControl = MockControl.createControl(PreparedStatement.class);
    PreparedStatement ps = (PreparedStatement)psControl.getMock();
   
    handler.getLobCreator();
    lobHandlerControl.setReturnValue(creator);
    ps.executeUpdate();
    psControl.setReturnValue(3);
    creator.close();
   
    lobHandlerControl.replay();
    lobCreatorControl.replay();
    psControl.replay();
   
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.