[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-5858) Cannot load entities with Clob or Lob properties into stateless sessions

Ralf Huthmann (JIRA) noreply at atlassian.com
Thu Feb 17 03:22:05 EST 2011


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-5858?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=40004#action_40004 ] 

Ralf Huthmann commented on HHH-5858:
------------------------------------

Fixing this Bug seems to be no big deal for Hibernate 3.6.0.Final. For read-only queries, i have successfully used a replacement for StatelessSessionImpl. This class is derived from StatelessSessionImpl and implements LobCreationContext. The missing execute-Method can be copied from SessionImpl. I will post a patch if i get approval (from my boss) to do so.

> Cannot load entities with Clob or Lob properties into stateless sessions
> ------------------------------------------------------------------------
>
>                 Key: HHH-5858
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5858
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.5.1
>            Reporter: James Roper
>
> I have a an entity with a Clob property:
> {code:java}
> @Lob
> private Clob clobProperty;
> {code}
> When I try and load it in a stateless session, I get:
> {noformat}
> Exception in thread "main" java.lang.ClassCastException: org.hibernate.impl.StatelessSessionImpl cannot be cast to org.hibernate.engine.jdbc.LobCreationContext
> 	at org.hibernate.Hibernate.getLobCreator(Hibernate.java:420)
> 	at org.hibernate.type.ClobType.nullSafeGet(ClobType.java:114)
> 	at org.hibernate.type.AbstractType.hydrate(AbstractType.java:105)
> 	at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:2267)
> 	at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1423)
> 	at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1351)
> 	at org.hibernate.loader.Loader.getRow(Loader.java:1251)
> 	at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:619)
> 	at org.hibernate.loader.Loader.loadSingleRow(Loader.java:307)
> 	at org.hibernate.impl.ScrollableResultsImpl.prepareCurrentRow(ScrollableResultsImpl.java:254)
> 	at org.hibernate.impl.ScrollableResultsImpl.next(ScrollableResultsImpl.java:123)
> {noformat}
> If Lobs in stateless sessions isn't supported, then at very least an error message to that effect should be thrown and the docs should be updated to reflect this, but I don't see why that should be the case, especially considering that both Lobs and stateless session both serve very similar purposes, they are for use when dealing with large datasets that may not fit in memory, and so could well be used together.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list