Results 1 to 3 of 3

Thread: save BLOB spring and hibernate

  1. #1
    Join Date
    Nov 2008
    Posts
    5

    Default save BLOB spring and hibernate

    how to save BLOB using hibernate and spring.

    i dont want to use AOP.

  2. #2
    Join Date
    Mar 2007
    Location
    Poland
    Posts
    341

    Default

    How you do it mainly depends on DB you are using and our pool.
    In SessionFactoryBean you have property lobHandler and you need to inject proper implementation for your DB/DataSource.

    For oracle and c3p0 this works:
    Code:
    <bean id="lobHandler" class="org.springframework.jdbc.support.lob.OracleLobHandler" lazy-init="true">
            <property name="nativeJdbcExtractor">
                <bean id="nativeJdbcExtractor"
                      class="org.springframework.jdbc.support.nativejdbc.C3P0NativeJdbcExtractor"/>
            </property>
        </bean>
    </beans>
    for oracle on websphere dataSource:
    Code:
     <bean id="lobHandler" class="org.springframework.jdbc.support.lob.OracleLobHandler" lazy-init="true">
            <property name="nativeJdbcExtractor">
                <bean id="nativeJdbcExtractor"
                      class="org.springframework.jdbc.support.nativejdbc.WebSphereNativeJdbcExtractor"/>
            </property>
        </bean>

  3. #3
    Join Date
    Mar 2010
    Posts
    3

    Default Maximum 4000 bytes allowed for BLOB insertion in iBatis

    Hi,
    I am trying to add a PDF into a table with column BLOB type, the size of the pdf is greater than 4000 bytes and it fails.
    Gives an error message saying that it is exceeding maximum size.

    I am using ojdbc14.jar for Oracle 10.2.0.4 version.
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
    "http://www.springframework.org/dtd/spring-beans.dtd">

    <beans>
    <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverM anagerDataSource" destroy-method="close">
    <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" />
    <property name="url" value="jdbc:oracle:thin:@<testip>:1522:<schema>" />
    <property name="username" value="user" />
    <property name="password" value="passwd" />

    </bean>

    <bean id="sqlMap" class="org.springframework.orm.ibatis.SqlMapClient FactoryBean">
    <property name="configLocation" value="classpath:config/SqlMapConfig.xml" />
    <property name="dataSource" ref="dataSource" />
    </bean>

    </beans>

    Tried to put the line
    <property name="Driver.SetBigStringTryClob" value="true" />
    under dataSource bean and it gives error that Driver class cannot be found.

    Please help.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •