Announcement Announcement Module
Collapse
No announcement yet.
LobHandlers and Hibernate tools in Eclipse Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • LobHandlers and Hibernate tools in Eclipse

    Hi,

    I'm using the Hibernate Eclipse tools to help me to create HQL queries. The problem is that I don't know where I can define the lobhander here.

    I get the following exception:

    Code:
    java.lang.IllegalStateException: No LobHandler found for configuration - lobHandler property must be set on LocalSessionFactoryBean
    	at org.springframework.orm.hibernate3.support.AbstractLobType.nullSafeGet(Unknown Source)
    	at org.hibernate.type.CustomType.nullSafeGet(Unknown Source)
    	at org.hibernate.type.AbstractType.hydrate(Unknown Source)
    	at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(Unknown Source)
    	at org.hibernate.loader.Loader.loadFromResultSet(Unknown Source)
    	at org.hibernate.loader.Loader.instanceNotYetLoaded(Unknown Source)
    	at org.hibernate.loader.Loader.getRow(Unknown Source)
    	at org.hibernate.loader.Loader.getRowFromResultSet(Unknown Source)
    	at org.hibernate.loader.Loader.doQuery(Unknown Source)
    	at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Unknown Source)
    	at org.hibernate.loader.Loader.loadEntity(Unknown Source)
    	at org.hibernate.loader.entity.AbstractEntityLoader.load(Unknown Source)
    	at org.hibernate.loader.entity.AbstractEntityLoader.load(Unknown Source)
    	at org.hibernate.persister.entity.AbstractEntityPersister.load(Unknown Source)
    	at org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(Unknown Source)
    	at org.hibernate.event.def.DefaultLoadEventListener.doLoad(Unknown Source)
    	at org.hibernate.event.def.DefaultLoadEventListener.load(Unknown Source)
    	at org.hibernate.event.def.DefaultLoadEventListener.onLoad(Unknown Source)
    	at org.hibernate.impl.SessionImpl.fireLoad(Unknown Source)
    	at org.hibernate.impl.SessionImpl.immediateLoad(Unknown Source)
    	at org.hibernate.proxy.AbstractLazyInitializer.initialize(Unknown Source)
    	at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(Unknown Source)
    	at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.invoke(Unknown Source)
    	at imserso.iparlamento.modelo.Archivo$$EnhancerByCGLIB$$a70ac5ab.hashCode(Unknown Source)
    	at java.util.HashMap.hash(Unknown Source)
    	at java.util.HashMap.containsKey(Unknown Source)
    	at java.util.HashSet.contains(Unknown Source)
    	at org.apache.commons.lang.builder.ToStringStyle.isRegistered(Unknown Source)
    	at org.apache.commons.lang.builder.ToStringStyle.appendInternal(Unknown Source)
    	at org.apache.commons.lang.builder.ToStringStyle.append(Unknown Source)
    	at org.apache.commons.lang.builder.ToStringBuilder.append(Unknown Source)
    	at imserso.iparlamento.modelo.IniciativaParlamentaria.toString(Unknown Source)
    	at org.hibernate.eclipse.console.views.QueryPageViewer$LabelProviderImpl.getColumnText(Unknown Source)
    	at org.eclipse.jface.viewers.TableViewer.doUpdateItem(Unknown Source)
    	at org.eclipse.jface.viewers.StructuredViewer$UpdateItemSafeRunnable.run(Unknown Source)
    	at org.eclipse.core.runtime.SafeRunner.run(Unknown Source)
    	at org.eclipse.core.runtime.Platform.run(Unknown Source)
    	at org.eclipse.ui.internal.JFaceUtil$1.run(Unknown Source)
    	at org.eclipse.jface.util.SafeRunnable.run(Unknown Source)
    	at org.eclipse.jface.viewers.StructuredViewer.updateItem(Unknown Source)
    	at org.eclipse.jface.viewers.TableViewer.createItem(Unknown Source)
    	at org.eclipse.jface.viewers.TableViewer.internalRefreshAll(Unknown Source)
    	at org.eclipse.jface.viewers.TableViewer.internalRefresh(Unknown Source)
    	at org.eclipse.jface.viewers.TableViewer.internalRefresh(Unknown Source)
    	at org.eclipse.jface.viewers.StructuredViewer$7.run(Unknown Source)
    	at org.eclipse.jface.viewers.StructuredViewer.preservingSelection(Unknown Source)
    	at org.eclipse.jface.viewers.StructuredViewer.refresh(Unknown Source)
    	at org.eclipse.jface.viewers.StructuredViewer.refresh(Unknown Source)
    	at org.eclipse.jface.viewers.TableViewer.inputChanged(Unknown Source)
    	at org.eclipse.jface.viewers.ContentViewer.setInput(Unknown Source)
    	at org.eclipse.jface.viewers.StructuredViewer.setInput(Unknown Source)
    	at org.hibernate.eclipse.console.views.QueryPageViewer.createTable(Unknown Source)
    	at org.hibernate.eclipse.console.views.QueryPageViewer.createControl(Unknown Source)
    	at org.hibernate.eclipse.console.views.QueryPageViewer.<init>(Unknown Source)
    	at org.hibernate.eclipse.console.views.QueryPageTabView.rebuild(Unknown Source)
    	at org.hibernate.eclipse.console.views.QueryPageTabView$1.contentsChanged(Unknown Source)
    	at org.hibernate.eclipse.console.views.QueryPageTabView$1.intervalAdded(Unknown Source)
    	at javax.swing.AbstractListModel.fireIntervalAdded(Unknown Source)
    	at org.hibernate.console.QueryPageModel.add(Unknown Source)
    	at org.hibernate.console.KnownConfigurations$1.queryPageCreated(Unknown Source)
    	at org.hibernate.console.ConsoleConfiguration.fireQueryPageCreated(Unknown Source)
    	at org.hibernate.console.ConsoleConfiguration.access$5(Unknown Source)
    	at org.hibernate.console.ConsoleConfiguration$3.execute(Unknown Source)
    	at org.hibernate.console.execution.DefaultExecutionContext.execute(Unknown Source)
    	at org.hibernate.console.ConsoleConfiguration.executeHQLQuery(Unknown Source)
    	at org.hibernate.eclipse.hqleditor.HQLEditor.executeQuery(Unknown Source)
    	at org.hibernate.eclipse.console.actions.ExecuteQueryAction.execute(Unknown Source)
    	at org.hibernate.eclipse.console.actions.ExecuteQueryAction.run(Unknown Source)
    	at org.eclipse.jface.action.Action.runWithEvent(Unknown Source)
    So, you will say, add the lobhandler. The problem is that the config file must be an Hibernate one. Mine is:

    Code:
    <hibernate-configuration>
        <session-factory>
    
            <property name="connection.driver_class">oracle.jdbc.OracleDriver</property>
            <property name="connection.url">XXX</property>
            <property name="connection.username">XXX</property>
            <property name="connection.password">XXX</property>
    
            <property name="connection.pool_size">1</property>
    
            <property name="dialect">org.hibernate.dialect.Oracle9Dialect</property>
    
            <property name="current_session_context_class">thread</property>
    
            <property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
    
            <property name="show_sql">true</property>
    
            <property name="hbm2ddl.auto">false</property>
    
        </session-factory>
    
    </hibernate-configuration>
    So I'm unable to use it with LobHandlers. Are you able to use it with them ? Any comment would be really welcome.

    Thanks in advance,
    Juan

  • #2
    Why MUST it be a hibernate one... I'm sure you are also setting other properties on the bean...

    Comment


    • #3
      Because the Hibernate Eclipse tool expects an hibernate.cfg.xml file...

      Comment


      • #4
        That has nothing to do with the LobHandler... The LobHandler is something Spring specific and not HibernateSpecific...

        Comment


        • #5
          Yes, so if you map a property with the Spring lob handler like:

          Code:
              <property name="content" access="field" type="org.springframework.orm.hibernate3.support.BlobByteArrayType">
                <column name="content" sql-type="blob"/>
              </property>
          You can use it in your application with something like:

          Code:
          <property name="lobHandler">
          	<bean class="imserso.comun.spring.OracleLobHandler">
          		<property name="nativeJdbcExtractor">
          			<bean class="org.springframework.jdbc.support.nativejdbc.WebSphereNativeJdbcExtractor"/>
          		</property>
          	</bean>
          </property>
          The problem is that this is impossible to set (AFAIK) in the Eclipse tool, and so it launches the exception posted above...

          Comment


          • #6
            Stop using the tool then .

            Ok that isn't a solution probably. You might want to take a look at MyEclipse which has an implementation of the HibernateTool which can use either a Spring configured implementation or the standard implementation. You would have to change to using MyEclipse in that case.

            Another solution I don't see, because it is a Spring thing and not a HIbernate thing. So I think it is quite impossible to install a LobHandler on a default SessionFactory without a LocalSessionFactoryBean...

            Comment


            • #7
              The Hibernate HQL query tool is really great -simple and powerful-, a big time saver... It would be a pity not to use it.

              As for moving to MyEclipse, that's out of question. We bought several ultra-expensive Rational Software Architect licences and I don't think we will be moving to another IDE any time soon...

              Well, so a last solution would be to unmap all the lob properties while using this tool to code the DAOs. This sucks, but that's the only other way I see...

              Thank you for your help anyway !

              Comment


              • #8
                Downloading the sources for the HibernateTools and adapt it for your own use could/would be another solution...

                Comment

                Working...
                X