Announcement Announcement Module
Collapse
No announcement yet.
BlobByteArrayType with hbm2java Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • BlobByteArrayType with hbm2java

    I am trying to use the new BlobByteArrayType in my hibernate mappings, but I haven't had any luck finding any documentation or examples. I've set up the hibernate mapping like so:

    <property name="chart" type="blob" class="org.springframework.orm.hibernate.support.B lobByteArrayType"/>

    I'm also using the hbm2java ant task to generate my java classes from the hibernate mappings. However, when I run hbm2java, spring complains that there is "No LobHandler found for configuration". I have configured my local session factory like so:

    <bean id="sessionFactory" class="org.springframework.orm.hibernate.LocalSess ionFactoryBean">
    <property name="dataSource"><ref local="dataSource"/></property>
    <property name="lobHandler"><value>${blob.handler}</value></property>

    ...

    (where blob handler is replaces with org.springframework.jdbc.support.lob.DefaultLobHan dler)

    I am assuning that this error is thrown because spring is not running when the hbm2java task is run. I'm puzzled, though, because it shouldn't need to be running when simply generating the java source files.

    Does anyone have any idea why BlobByteArrayType would complain about a missing lobHandler when it's not even being asked to do its IOC magic?

  • #2
    It complains because the LobHandler is just available at initialization time: During normal runtime, it needs to fetch it on initialization or it won't be able to work later on. Therefore, it currently follows the fail-fast principle and throws the exception on initialization.

    The problem is that hbm2java obviously instantiates all custom types too, although it doesn't do data access with them. In the light of this, I'll probably relax the check in our Hibernate LOB types, throwing the exception on actual data access rather than on initialization.

    Juergen

    Comment


    • #3
      Thanks Juergen. This relaxed error checking will be a great benefit for those of us who use hbm2java in our build process. I'm looking forward to the 1.1 release!

      Comment

      Working...
      X