Results 1 to 3 of 3

Thread: BlobByteArrayType with hbm2java

  1. #1
    Join Date
    Aug 2004
    Posts
    6

    Default 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. #2
    Join Date
    Aug 2004
    Location
    Linz, Austria
    Posts
    391

    Default

    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

  3. #3
    Join Date
    Aug 2004
    Posts
    6

    Default

    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!

Similar Threads

  1. Replies: 5
    Last Post: Sep 11th, 2006, 04:00 PM
  2. Replies: 1
    Last Post: Sep 7th, 2005, 04:43 PM
  3. Replies: 2
    Last Post: Aug 12th, 2005, 07:37 AM
  4. Replies: 4
    Last Post: Jun 10th, 2005, 08:24 AM

Posting Permissions

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