Results 1 to 8 of 8

Thread: LobHandlers and Hibernate tools in Eclipse

Hybrid View

  1. #1
    Join Date
    Jul 2005
    Location
    Bangkok
    Posts
    24

    Default 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. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,695

    Default

    Why MUST it be a hibernate one... I'm sure you are also setting other properties on the bean...
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  3. #3
    Join Date
    Jul 2005
    Location
    Bangkok
    Posts
    24

    Default

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

  4. #4
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,695

    Default

    That has nothing to do with the LobHandler... The LobHandler is something Spring specific and not HibernateSpecific...
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  5. #5
    Join Date
    Jul 2005
    Location
    Bangkok
    Posts
    24

    Default

    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...

  6. #6
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,695

    Default

    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...
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

Posting Permissions

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