Hi,
the insert of a Blob to the database throws the following exception:
So we tried to to integrate the org.springframework.jdbc.support.lob.OracleLobHand ler in a ROO/JPA standard configuration.Code:Caused by: javax.persistence.RollbackException: Error while committing the transaction at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:93) at org.springframework.orm.jpa.JpaTransactionManager.doCommit(JpaTransactionManager.java:467) ... 10 more Caused by: java.lang.ClassCastException: $Proxy45 at oracle.jdbc.driver.OraclePreparedStatement.setBlob(OraclePreparedStatement.java:6890)
persistence.xmlCode:<jee:jndi-lookup jndi-name="jdbc/xxx-db" id="dataSource" resource-ref="true"></jee:jndi-lookup> <bean class="org.springframework.orm.jpa.JpaTransactionManager" id="transactionManager"> <property name="entityManagerFactory" ref="entityManagerFactory" /> </bean> <tx:annotation-driven mode="aspectj" transaction-manager="transactionManager" /> <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"> <property name="dataSource" ref="dataSource" /> </bean>
Without JPA we add the LobHandler to the "LocalSessionFactoryBean"... But we found no way to do this with JPA. We spend a lot of time searching a solution...Code:<persistence-unit name="persistenceUnit" transaction-type="RESOURCE_LOCAL"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <properties> <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect" /> <property name="hibernate.ejb.naming_strategy" value="org.hibernate.cfg.ImprovedNamingStrategy" /> <property name="hibernate.id.new_generator_mappings" value="true" /> <property name="hibernate.show_sql" value="false" /> <property name="hibernate.format_sql" value="true" /> <property name="hibernate.jdbc.batch_size" value="100"/> </properties> </persistence-unit>
Thanks in advance for any help!


Reply With Quote
