-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Author Message
 Post subject: Posgres - Large Objects may not be used in auto-commit mode!
PostPosted: Tue Jun 28, 2005 3:16 am 
Newbie

Joined: Tue Jun 28, 2005 2:57 am
Posts: 2
Hi,

I'm using spring 1.2.1, hibernate 3.x and postgres 8.x.
I've problem when trying to retrieve an instance of a class containing a java.sql.Blob field.
I've tested outside spring (using Hibernate SessionFactory), it works fine and the content of my Blob is correct.

I've debug my spring webapp and the properties of the Hibernate Session seems to be correct (autocommit=false).

I really don't understand what's happening...I've submitted the problem on the spring forum, but everyone seems gone in vacation ;-) I hope to receive some help here!

Thanks in advance.

Hibernate version: 3.0

Mapping documents:

<class name="com.poc.core.model.message.AbstractMessage" table="abstract_message">
<id name="id" type="long">
<generator class="identity"/>
</id>

<discriminator column="abstract_message_type" type="string"/>
<property name="messageIdentifier" column="message_identifier"/>

<subclass name="com.poc.core.model.message.AbstractNotification" discriminator-value="AbstractNotification">
<property name="xml" type="java.sql.Blob"/>
</subclass>
</class>



Hibernate SessionFactory declaration in spring config file:

<!-- Hibernate SessionFactory -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource"><ref local="dataSource"/></property>
<property name="mappingResources">
<value>com/core/model/model.hbm.xml</value>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">${hibernate.dialect}</prop>
<prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
<prop key="hibernate.connection.release_mode">on_close</prop>
<prop key="hibernate.connection.autocommit">false</prop>
</props>
</property>
</bean>


Full stack trace of any exception that occurs:
org.postgresql.util.PSQLException: Large Objects may not be used in auto-commit mode.
at org.postgresql.largeobject.LargeObjectManager.open(LargeObjectManager.java:172)
at org.postgresql.largeobject.LargeObjectManager.open(LargeObjectManager.java:158)
at org.postgresql.jdbc2.AbstractJdbc2Blob.<init>(AbstractJdbc2Blob.java:26)
at org.postgresql.jdbc3.AbstractJdbc3Blob.<init>(AbstractJdbc3Blob.java:20)
at org.postgresql.jdbc3.Jdbc3Blob.<init>(Jdbc3Blob.java:20)
at org.postgresql.jdbc3.Jdbc3ResultSet.getBlob(Jdbc3ResultSet.java:54)
at org.postgresql.jdbc2.AbstractJdbc2ResultSet.getBlob(AbstractJdbc2ResultSet.java:312)
at org.hibernate.type.BlobType.get(BlobType.java:56)
at org.hibernate.type.BlobType.nullSafeGet(BlobType.java:110)
at org.hibernate.type.AbstractType.hydrate(AbstractType.java:80)
at org.hibernate.persister.entity.BasicEntityPersister.hydrate(BasicEntityPersister.java:1699)
at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:925)
at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:876)
at org.hibernate.loader.Loader.getRow(Loader.java:789)
at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:295)
at org.hibernate.loader.Loader.doQuery(Loader.java:389)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:208)
at org.hibernate.loader.Loader.loadEntity(Loader.java:1278)


Top
 Profile  
 
 Post subject: Re: Posgres - Large Objects may not be used in auto-commit m
PostPosted: Tue Jun 28, 2005 1:20 pm 
Newbie

Joined: Tue Jun 28, 2005 1:11 pm
Posts: 3
hi,
I'm using appfuse, also spring hibernate 3.x and postgres 8.x.
but i met the problem not same with you,
Bad SQL grammar [] in task 'HibernateTemplate'; nested exception is java.sql.SQLException: ERROR: column "doc" is of type bytea but expression is of type integer
can you post your callback code?
thanks


Top
 Profile  
 
 Post subject: try add this code to your sourse
PostPosted: Tue Jun 28, 2005 1:34 pm 
Newbie

Joined: Tue Jun 28, 2005 1:11 pm
Posts: 3
getHibernateTemplate().flush();


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 28, 2005 2:35 pm 
Newbie

Joined: Tue Jun 28, 2005 2:57 am
Posts: 2
Thank you for reply!

My code is so simple...I really think that the solution is a matter of configuration...

Anyway, here it is (from my HibernateDataAccessObject class which extends HibernateDaoSupport)

Code:

public Object get(Class clazz, Serializable id) throws CoreException {
  Object o = null;
 
      try {
   
           o = getHibernateTemplate().get(clazz, id);
   
      } catch (DataAccessException dae) {
   
           dae.printStackTrace();
     
           DAOException daoe = new DAOException();
           daoe.setErrorCode(DAOException.ERROR_CODE_GENERAL_FAILURE);
           throw daoe;
      }

      return o;
}




Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 29, 2005 3:47 am 
Newbie

Joined: Tue Jun 28, 2005 1:11 pm
Posts: 3
thank you too,
i think there are session by with spring,
cause i think you said the only run under the hibernate can access the data,
i googled ,and guess BlobByteArrayType may can solve this problem,
but have not figure out
yet.
:(


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.