Hibernate 3 com campo Blob Oracle 9i

Fala Galera do portal!!!

Tenho um problema para compartilhar com a galera, e talvez alguém consiga achar o porquê…

Achei em um forum sobre o hibernate uma implementação do campo Blob no Oracle, ela funciona muito bem… exceto que… em algumas vezes, quando o arquivo é grande, maior que 5k, e tento persistir o objeto que possui o campo blob… parece que o hibernate dá uma travada… ou entre em um loop infinito…
Bom… o meu mapeamento e a classe estão abaixo… espero ter conseguido explicar meu problema… se alguém já tiver passado por isso… e/ou souber o porquê… por favor poste aki!!! :grin:

Ah… antes que alguém diga para aumentar o tamanho do buffer… eu já tentei isso… :grin:

abraços a todos!!!

Classe

[code]package model;

import JHibernateGenericDAO;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.sql.Blob;
import java.sql.SQLException;

import java.util.Vector;
import org.hibernate.Hibernate;

public class JPropertyValue
{

 private int id;
 private JProperty property;
 private String value;    
 private byte[] image;

 /** Creates a new instance of JPropertyValue */
 public JPropertyValue()
 {
 }
    
 public int getId() {
     return id;
 }

 public void setId(int id) {
     this.id = id;
 }

 public JProperty getProperty() {
     return property;
 }

 public void setProperty(JProperty property) {
     this.property = property;
 }

 public String getValue() {
     return value;
 }

 public void setValue(String value) {
     this.value = value;
 }
 
 public String toString() {
     return this.value;
 }  

 public byte[] getImage() {
     return image;
 }

 public void setImage(byte[] image) {
     this.image = image;
 }
 
  /** Não chame esse método.  Usado apenas pelo Hibernate. */
 public void setImageBlob(Blob imageBlob) {
     if (null != imageBlob)
         this.image = this.toByteArray(imageBlob);
     else
         this.image = null;
 }
 
 /** Não chame esse método.  Usado apenas pelo Hibernate. */
 public Blob getImageBlob() {
     if(null != this.image)
         return Hibernate.createBlob(this.image); 
     else
         return null;
 } 
 
 private byte[] toByteArray(Blob fromBlob) { 
     ByteArrayOutputStream baos = new ByteArrayOutputStream(); 
     try {  
         return toByteArrayImpl(fromBlob, baos); 
     } 
     catch (SQLException e) {
         throw new RuntimeException(e); 
     } 
     catch (IOException e) {
         throw new RuntimeException(e);
     } 
     finally { 
         if (baos != null) { 
             try { 
                 baos.close(); 
             }
             catch (IOException ex) {
             }
         }  
     }
 }
 
 private byte[] toByteArrayImpl(Blob fromBlob, ByteArrayOutputStream baos)  throws SQLException, IOException {
     byte[] buf = new byte[4000];
     InputStream is = fromBlob.getBinaryStream();
     try {   
         for (;;) { 
             int dataSize = is.read(buf);
             if (dataSize == -1)   
                 break;  
             baos.write(buf, 0, dataSize); 
         } 
     } 
     finally {
         if (is != null) { 
             try {
                 is.close(); 
             }
             catch (IOException ex) { 
             } 
         } 
     } 
     return baos.toByteArray();
 }

}[/code]

Mapeamento

[code]<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="JPropertyValue" table="PROPRIEDADE_VALOR" dynamic-update="true" dynamic-insert="true">
<!-- Identificador da classe -->
<id name="id" column="PRVA_CD_CHAVE" type="integer">
<generator class="increment"/>
</id>

             &lt;!-- Propriedades --&gt;
             &lt;property name=&quot;imageBlob&quot;  column=&quot;PRVA_MM_ARQUIVO&quot;     type=&quot;blob&quot;/&gt;
             &lt;property name=&quot;value&quot;      column=&quot;PRVA_NM_NOME&quot;                   /&gt;
             
             &lt;!-- Relacionamentos da classe --&gt;
             &lt;!-- Com JProperty --&gt;
             &lt;many-to-one name=&quot;property&quot; class=&quot;JProperty&quot;
                          cascade=&quot;none&quot; fetch=&quot;join&quot; update=&quot;true&quot; insert=&quot;true&quot;
                          column=&quot;PROP_CD_CHAVE&quot;
             /&gt;
             
&lt;/class&gt;

</hibernate-mapping>[/code]

Fala galera!!!

Pô… acho que consegui resolver o meu problema… dei uma olhada pelos foruns sobre hibernate… em alguns deles vi comentarios dizendo que alguns drivers da oracle mais antigos tem problemas com blobs… então troquei o que eu usava (classes12.jar) pelo ojbdc14.jar… e parou de dar erro… ahuhuhuahahu…

valew por tudo galera!!!