[jboss-jira] [JBoss JIRA] Commented: (EJBTHREE-517) multiple blob update operations hung up JBoss

Emmanuel Bernard (JIRA) jira-events at lists.jboss.org
Tue Feb 13 20:53:30 EST 2007


    [ http://jira.jboss.com/jira/browse/EJBTHREE-517?page=comments#action_12353032 ] 
            
Emmanuel Bernard commented on EJBTHREE-517:
-------------------------------------------

Only Oracle users are having such issues, did you dig into the Oracle bug DB?

> multiple blob update operations hung up JBoss
> ---------------------------------------------
>
>                 Key: EJBTHREE-517
>                 URL: http://jira.jboss.com/jira/browse/EJBTHREE-517
>             Project: EJB 3.0
>          Issue Type: Bug
>    Affects Versions: EJB 3.0 RC5 - PFD
>         Environment: oracle 10.1.0.2.0
> Java 1.5.0_06
> Windows XP.
>            Reporter: Quande Ren
>         Assigned To: Emmanuel Bernard
>
> I posted this in the forum, nobody post any reply, But I believe it is a bug, so I copied it here.
> The blob code works fine when there is only one blob operation within one transaction, however, if the transaction includes several blob update operation, then the JBoss hungs up there. 
> Here is the entity code
> package test;
> import java.io.ByteArrayOutputStream;
> import java.io.InputStream;
> import java.sql.Blob;
> import javax.persistence.Basic;
> import javax.persistence.Entity;
> import javax.persistence.FetchType;
> import javax.persistence.Id;
> import javax.persistence.Lob;
> import javax.persistence.Table;
> import javax.persistence.Transient;
> import org.hibernate.Hibernate;
> @Entity
> @Table(name = "LongValue")
> public class LongValue {
>   private Integer id;
>   public LongValue() {
>   }
>   @Id
>   public Integer getId() {
>     return this.id;
>   }
>   public void setId(Integer id) {
>     this.id = id;
>   }
>   private Blob theValue;
>   @Lob @Basic(fetch=FetchType.LAZY)
>   protected Blob getTheValue() {
>     return theValue;
>   }
>   protected void setTheValue(Blob theValue) {
>     this.theValue = theValue;
>   }
>   @Transient
>   public void setValue(String aValue) throws Exception{
>      this.theValue=Hibernate.createBlob(aValue.getBytes());
>   }
>   @Transient
>   public String getValue() throws Exception{
>     Blob blob=this.getTheValue();
>     if(blob==null){
>       return null;
>     }
>     int length=(int)blob.length();
>     InputStream in=blob.getBinaryStream();
>     ByteArrayOutputStream bout=new ByteArrayOutputStream(length);
>     byte[] b=new byte[1000];
>     while(true){
>       length=in.read(b);
>       if(length<0){
>         break;
>       }
>       bout.write(b, 0, length);
>     }
>     in.close();
>     bout.close();
>     return new String(bout.toByteArray());
>   }
> }
> This code will success because there is only one blob update:
>         LongValue lv=manager.find(LongValue.class,id1 );
>         lv.setValue(bigValue);
> This code will cause the jboss hung up there for unlimited time because there are several blob updates:
>         LongValue lv=manager.find(LongValue.class,id1 );
>         lv.setValue(bigValue+"1");
>         lv=manager.find(LongValue.class,id2 );
>         lv.setValue(bigValue+"2");
>         lv=manager.find(LongValue.class,id3 );
>         lv.setValue(bigValue+"3");
>         lv=manager.find(LongValue.class,id4 );
>         lv.setValue(bigValue+"4");
> 	
> the oracle table structure is like this:
> SQL> desc longvalue
>  Name                                      Null?    Type
>  ----------------------------------------- -------- ----------------------------
>  ID                                        NOT NULL NUMBER(10)
>  THEVALUE                                           BLOB
> 		
> I checked that seems inserting several new records seems working. just updating several records does not work.

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

        



More information about the jboss-jira mailing list