5

According to this post i changed my session factory definition from

<bean id="sessionFactory"
    class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean" 
    p:dataSource-ref="dataSource" p:lobHandler-ref="oracleLobHandler">
    <property name="annotatedClasses">
    <list>
        [..]

into

<bean id="sessionFactory"
    class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"
    p:dataSource-ref="dataSource">
    <property name="annotatedClasses">
    <list>
        [..]

Unfortunately there is no possibility to define the LobHandler as it was in hibernate3. As there is still the following written in the "Lobhandler"s javadoc it seems still necessary

Summarizing the recommended options (for actual LOB fields):

  • JDBC 4.0 driver: DefaultLobHandler with streamAsLob=true.

  • PostgreSQL: DefaultLobHandler with wrapAsLob=true. Oracle 9i/10g:

  • OracleLobHandler with a connection-pool-specific NativeJdbcExtractor.

  • For all other database drivers (and for non-LOB fields that might potentially turn into LOBs on some databases): a plain DefaultLobHandler.

So, is it still necessary to define the lobHandler in hibernate4 or not??? And if so, where can I define it?

Community
  • 1
  • 1
Hons
  • 3,804
  • 3
  • 32
  • 50
  • As I couldn't find any sufficient answer to this I asked it on the springsource-forum right now http://forum.springsource.org/showthread.php?121103-hibernate4-SessionFactory-and-LOBHandler&p=396475#post396475 – Hons Jan 12 '12 at 12:42

1 Answers1

1

It seems like you don't need it. They recommend using the native types as opposed to user types.

See http://www.sureshpw.com/2012/04/spring-hibernate-4.html.

bdetweiler
  • 1,544
  • 1
  • 16
  • 27