3 Replies Latest reply: Sep 14, 2011 7:57 AM by Dattaram Porob RSS

PostgreSQL 9.0 LOB creation with Hibernate 4

Dattaram Porob Newbie

I am using PostgresQL driver postgresql-9.0-801.jdbc4.jar and the default hibernate that comes with AS 7. I have an entity which has one of its String attributes mapped to the postgres 'text' type and this attribute is marked with the annotation '@Lob'. I get the following exception when trying to persist this entity: Caused by: java.lang.IllegalArgumentException: interface org.hibernate.engine.jdbc.ClobImplementer is not visible from class loader         at java.lang.reflect.Proxy.getProxyClass(Proxy.java:353) [:1.6.0_11]         at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:581) [:1.6.0_11]         at org.hibernate.engine.jdbc.ClobProxy.generateProxy(ClobProxy.java:191)         at org.hibernate.engine.jdbc.NonContextualLobCreator.createClob(NonContextualLobCreator.java:62)         at org.hibernate.type.descriptor.java.StringTypeDescriptor.unwrap(StringTypeDescriptor.java:70)         at org.hibernate.type.descriptor.java.StringTypeDescriptor.unwrap(StringTypeDescriptor.java:40)         at org.hibernate.type.descriptor.sql.ClobTypeDescriptor$2$1.doBind(ClobTypeDescriptor.java:69)         at org.hibernate.type.descriptor.sql.BasicBinder.bind(BasicBinder.java:82)         at org.hibernate.type.AbstractStandardBasicType.nullSafeSet(AbstractStandardBasicType.java:305)         at org.hibernate.type.AbstractStandardBasicType.nullSafeSet(AbstractStandardBasicType.java:300)         at org.hibernate.type.AbstractSingleColumnStandardBasicType.nullSafeSet(AbstractSingleColumnStandardBasicType.java:57)         at org.hibernate.persister.entity.AbstractEntityPersister.dehydrate(AbstractEntityPersister.java:2593)         at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2841)         at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3281)         at org.hibernate.action.internal.EntityInsertAction.execute(EntityInsertAction.java:80)         at org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:273)         at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:265)         at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:186)         at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:336)         at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50)         at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1073)         at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:318)         at org.hibernate.engine.transaction.synchronization.internal.SynchronizationCallbackCoordinatorImpl.beforeCompletion(SynchronizationCallbackCoordinatorImpl.java:104) I also get the following warning when this app gets deployed: 06:34:24,816 WARN  [org.jboss.jca.core.connectionmanager.listener.TxConnectionListener] (MSC service thread 1-2) IJ000305: Connection error occured: org.jboss.jca.core.connectionmanager.listener.TxConnectionListener@1ff4999[state=NORMAL managed connection=org.jboss.jca.adapters.jdbc.xa.XAManagedConnection@154614c connection handles=1 lastUse=1315530264354 trackByTx=false pool=org.jboss.jca.core.connectionmanager.pool.strategy.OnePool@10aab7d pool internal context=org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool@180daa6 xaResource=XAResourceWrapperImpl@bff36c[xaResource=org.jboss.jca.adapters.jdbc.xa.XAManagedConnection@154614c pad=false overrideRmValue=false productName=PostgreSQL productVersion=9.0.2 jndiName=java:/sysDB] txSync=null]: java.lang.reflect.UndeclaredThrowableException         at $Proxy33.createClob(Unknown Source)  at org.jboss.jca.adapters.jdbc.WrappedConnection.createClob(WrappedConnection.java:1255) This used to work fine in JBoss 4.2.3 and using hibernate 3.3.2.GA and the same postgres driver. I think this is not related but I still tried adding the following line in bin/standalone.conf (as mentioned at https://docs.jboss.org/author/display/AS7/How+do+I+migrate+my+application+from+AS5+or+AS6+to+AS7) but the issue still exists: JAVA_OPTS="$JAVA_OPTS -Dhibernate.jdbc.use_streams_for_binary=false" Looks like this postgres driver does not support Clob creation but then how were things working fine in hibernate 3.3.2 GA ?

  • 1. Re: PostgreSQL 9.0 LOB creation with Hibernate 4
    Scott Marlow Master

    I'm not sure about the JCA issue, maybe someone from the JCA team will respond to that issue.

    I also get the following warning when this app gets deployed: 06:34:24,816 WARN  [org.jboss.jca.core.connectionmanager.listener.TxConnectionListener] (MSC service thread 1-2) IJ000305: Connection error occured: org.jboss.jca.core.connectionmanager.listener.TxConnectionListener@1ff4999[state=NORMAL managed connection=org.jboss.jca.adapters.jdbc.xa.XAManagedConnection@154614c connection handles=1 lastUse=1315530264354 trackByTx=false pool=org.jboss.jca.core.connectionmanager.pool.strategy.OnePool@10aab7d pool internal context=org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool@180daa6 xaResource=XAResourceWrapperImpl@bff36c[xaResource=org.jboss.jca.adapters.jdbc.xa.XAManagedConnection@154614c pad=false overrideRmValue=false productName=PostgreSQL productVersion=9.0.2 jndiName=java:/sysDB] txSync=null]: java.lang.reflect.UndeclaredThrowableException         at $Proxy33.createClob(Unknown Source)  at org.jboss.jca.adapters.jdbc.WrappedConnection.createClob(WrappedConnection.java:1255)


    This used to work fine in JBoss 4.2.3 and using hibernate 3.3.2.GA and the same postgres driver. I think this is not related but I still tried adding the following line in bin/standalone.conf (as mentioned at https://docs.jboss.org/author/display/AS7/How+do+I+migrate+my+application+from+AS5+or+AS6+to+AS7) but the issue still exists: JAVA_OPTS="$JAVA_OPTS -Dhibernate.jdbc.use_streams_for_binary=false" Looks like this postgres driver does not support Clob creation but then how were things working fine in hibernate 3.3.2 GA ?

     

     

    For the Hibernate classloader issue, I'm not sure about that one.  If  org.hibernate.engine.jdbc.ClobProxy is used on application classes, then it looks correct for application classes.  If that ClobProxy is always used for Hibernate classes, I think it should always use the ClobImplementer.class.getClassLoader() class loader.

     

    Dattaram Porob wrote:

     

    I am using PostgresQL driver postgresql-9.0-801.jdbc4.jar and the default hibernate that comes with AS 7. I have an entity which has one of its String attributes mapped to the postgres 'text' type and this attribute is marked with the annotation '@Lob'. I get the following exception when trying to persist this entity: Caused by: java.lang.IllegalArgumentException: interface org.hibernate.engine.jdbc.ClobImplementer is not visible from class loader         at java.lang.reflect.Proxy.getProxyClass(Proxy.java:353) [:1.6.0_11]         at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:581) [:1.6.0_11]         at org.hibernate.engine.jdbc.ClobProxy.generateProxy(ClobProxy.java:191)         at org.hibernate.engine.jdbc.NonContextualLobCreator.createClob(NonContextualLobCreator.java:62)         at org.hibernate.type.descriptor.java.StringTypeDescriptor.unwrap(StringTypeDescriptor.java:70)         at org.hibernate.type.descriptor.java.StringTypeDescriptor.unwrap(StringTypeDescriptor.java:40)         at org.hibernate.type.descriptor.sql.ClobTypeDescriptor$2$1.doBind(ClobTypeDescriptor.java:69)         at org.hibernate.type.descriptor.sql.BasicBinder.bind(BasicBinder.java:82)         at org.hibernate.type.AbstractStandardBasicType.nullSafeSet(AbstractStandardBasicType.java:305)         at org.hibernate.type.AbstractStandardBasicType.nullSafeSet(AbstractStandardBasicType.java:300)         at org.hibernate.type.AbstractSingleColumnStandardBasicType.nullSafeSet(AbstractSingleColumnStandardBasicType.java:57)         at org.hibernate.persister.entity.AbstractEntityPersister.dehydrate(AbstractEntityPersister.java:2593)         at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2841)         at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3281)         at org.hibernate.action.internal.EntityInsertAction.execute(EntityInsertAction.java:80)         at org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:273)         at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:265)         at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:186)         at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:336)         at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50)         at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1073)         at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:318)         at org.hibernate.engine.transaction.synchronization.internal.SynchronizationCallbackCoordinatorImpl.beforeCompletion(SynchronizationCallbackCoordinatorImpl.java:104)

  • 3. Re: PostgreSQL 9.0 LOB creation with Hibernate 4
    Dattaram Porob Newbie

    The exception did go away when I removed the @Lob annotation and the persistence also worked fine. Looks like hibernate 4 maps java string fields to postgresql 'text' column without need for an annotation.