-->
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.  [ 2 posts ] 
Author Message
 Post subject: BLOB and Oracle
PostPosted: Mon Mar 06, 2006 7:40 am 
Newbie

Joined: Mon Mar 06, 2006 7:25 am
Posts: 10
Hi,

I'm using JBOSS 4.0.4 RC1.

Here's an EntityBean i'm using :

Code:
@Entity
@DiscriminatorValue("RUNTIME_EVENT")
public class RuntimeEvent extends Event
{
   /**
    *
    */
   private static final long serialVersionUID = 3409277386338283244L;
   private Throwable throwable;
   private String object;
   private Integer position;
   private String method;

   public RuntimeEvent()
   {
      super();
      init();
   }
   
   public RuntimeEvent(Integer level, String message)
   {
      super(level, message);
      init();
   }

   public RuntimeEvent(Integer level, String message, RuntimeEvent parent)
   {
      super(level, message, parent);
      init();
   }

   public RuntimeEvent(Integer level, String message, Throwable t)
   {
      this(level, message);
      setThrowable(t);
   }
   
   private void init()
   {
   }

   @Column(name="CALLER_OBJECT")
   public String getObject() { return object; }
   public void setObject(String callerObject) { this.object = callerObject; }

   @Column(name="CALLER_METHOD")
   public String getMethod() { return method; }
   public void setMethod(String callerMethod) { this.method = callerMethod; }

   @Column(name="CALLER_POSITION")
   public Integer getPosition() { return position;   }
   public void setPosition(Integer callerPosition) { this.position = callerPosition; }

   @Column(name="THROWABLE")
   @Lob
   public Throwable getThrowable() { return throwable; }
   public void setThrowable(Throwable throwable)
   {
      if(throwable instanceof Serializable)
         this.throwable = throwable;
   }
}


As you can see, Throwable is a LOB ...

Then i'm using EntityManager (through find , or createQuery) within a Stateless bean, to retreive some instance of my RuntimeEvent :
I tried with Oracle 10gR2 , everything thing works fine.
Now, with Oracle 9iR2, I get the following log into jboss logfile :

Code:
2006-03-06 10:19:17,567 DEBUG [org.hibernate.jdbc.ConnectionManager] opening JDBC connection
2006-03-06 10:19:17,567 DEBUG [org.hibernate.SQL] update LOG_EVENT set EVENT_MESSAGE=?, EVENT_DATE=?, EVENT_LEVEL=?, EVENT_SOURCE=?, PARENT_ID=?, CALLER_OBJECT=?, CALLER_METHOD=?, CALLER_POSITION=?, THROWABLE=? where EVENT_ID=?
2006-03-06 10:19:17,567 DEBUG [org.hibernate.jdbc.AbstractBatcher] reusing prepared statement
2006-03-06 10:19:17,567 DEBUG [org.hibernate.SQL] update LOG_EVENT set EVENT_MESSAGE=?, EVENT_DATE=?, EVENT_LEVEL=?, EVENT_SOURCE=?, PARENT_ID=?, CALLER_OBJECT=?, CALLER_METHOD=?, CALLER_POSITION=?, THROWABLE=? where EVENT_ID=?
2006-03-06 10:19:17,567 DEBUG [org.hibernate.jdbc.AbstractBatcher] reusing prepared statement
2006-03-06 10:19:17,567 DEBUG [org.hibernate.SQL] update LOG_EVENT set EVENT_MESSAGE=?, EVENT_DATE=?, EVENT_LEVEL=?, EVENT_SOURCE=?, PARENT_ID=?, CALLER_OBJECT=?, CALLER_METHOD=?, CALLER_POSITION=?, THROWABLE=? where EVENT_ID=?
2006-03-06 10:19:17,578 DEBUG [org.hibernate.jdbc.AbstractBatcher] reusing prepared statement
2006-03-06 10:19:17,578 DEBUG [org.hibernate.SQL] update LOG_EVENT set EVENT_MESSAGE=?, EVENT_DATE=?, EVENT_LEVEL=?, EVENT_SOURCE=?, PARENT_ID=?, CALLER_OBJECT=?, CALLER_METHOD=?, CALLER_POSITION=?, THROWABLE=? where EVENT_ID=?
2006-03-06 10:19:17,578 DEBUG [org.hibernate.jdbc.AbstractBatcher] reusing prepared statement
2006-03-06 10:19:17,578 DEBUG [org.hibernate.SQL] update LOG_EVENT set EVENT_MESSAGE=?, EVENT_DATE=?, EVENT_LEVEL=?, EVENT_SOURCE=?, PARENT_ID=?, CALLER_OBJECT=?, CALLER_METHOD=?, CALLER_POSITION=?, THROWABLE=? where EVENT_ID=?
2006-03-06 10:19:17,578 DEBUG [org.hibernate.jdbc.AbstractBatcher] Executing batch size: 5
2006-03-06 10:19:17,588 DEBUG [org.hibernate.jdbc.AbstractBatcher] success of batch update unknown: 0
2006-03-06 10:19:17,588 DEBUG [org.hibernate.jdbc.AbstractBatcher] success of batch update unknown: 1
2006-03-06 10:19:17,588 DEBUG [org.hibernate.jdbc.AbstractBatcher] success of batch update unknown: 2
2006-03-06 10:19:17,588 DEBUG [org.hibernate.jdbc.AbstractBatcher] success of batch update unknown: 3
2006-03-06 10:19:17,588 DEBUG [org.hibernate.jdbc.AbstractBatcher] success of batch update unknown: 4
2006-03-06 10:19:17,588 DEBUG [org.hibernate.jdbc.AbstractBatcher] about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
2006-03-06 10:19:17,588 DEBUG [org.hibernate.jdbc.ConnectionManager] aggressively releasing JDBC connection
2006-03-06 10:19:17,588 DEBUG [org.hibernate.jdbc.ConnectionManager] releasing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
2006-03-06 10:19:17,638 DEBUG [org.jboss.ejb3.entity.ManagedEntityManagerFactory] ************** closing entity managersession **************


This works , even if i don't know why it runs UPDATE.

NOW, always with 9iR2, if I run the same kind of find method to get another instance i get :
Code:
2006-03-06 10:19:17,738 DEBUG [org.hibernate.jdbc.ConnectionManager] opening JDBC connection
2006-03-06 10:19:17,738 DEBUG [org.hibernate.SQL] update LOG_EVENT set EVENT_MESSAGE=?, EVENT_DATE=?, EVENT_LEVEL=?, EVENT_SOURCE=?, PARENT_ID=?, CALLER_OBJECT=?, CALLER_METHOD=?, CALLER_POSITION=?, THROWABLE=? where EVENT_ID=?
2006-03-06 10:19:17,738 DEBUG [org.hibernate.jdbc.AbstractBatcher] reusing prepared statement
2006-03-06 10:19:17,738 DEBUG [org.hibernate.SQL] update LOG_EVENT set EVENT_MESSAGE=?, EVENT_DATE=?, EVENT_LEVEL=?, EVENT_SOURCE=?, PARENT_ID=?, CALLER_OBJECT=?, CALLER_METHOD=?, CALLER_POSITION=?, THROWABLE=? where EVENT_ID=?
2006-03-06 10:19:17,738 DEBUG [org.hibernate.jdbc.AbstractBatcher] reusing prepared statement
2006-03-06 10:19:17,738 DEBUG [org.hibernate.SQL] update LOG_EVENT set EVENT_MESSAGE=?, EVENT_DATE=?, EVENT_LEVEL=?, EVENT_SOURCE=?, PARENT_ID=?, CALLER_OBJECT=?, CALLER_METHOD=?, CALLER_POSITION=?, THROWABLE=? where EVENT_ID=?
2006-03-06 10:19:17,738 DEBUG [org.hibernate.jdbc.AbstractBatcher] reusing prepared statement
2006-03-06 10:19:17,738 DEBUG [org.hibernate.SQL] update LOG_EVENT set EVENT_MESSAGE=?, EVENT_DATE=?, EVENT_LEVEL=?, EVENT_SOURCE=?, PARENT_ID=?, CALLER_OBJECT=?, CALLER_METHOD=?, CALLER_POSITION=?, THROWABLE=? where EVENT_ID=?
2006-03-06 10:19:17,738 DEBUG [org.hibernate.jdbc.AbstractBatcher] reusing prepared statement
2006-03-06 10:19:17,738 DEBUG [org.hibernate.SQL] update LOG_EVENT set EVENT_MESSAGE=?, EVENT_DATE=?, EVENT_LEVEL=?, EVENT_SOURCE=?, PARENT_ID=?, CALLER_OBJECT=?, CALLER_METHOD=?, CALLER_POSITION=?, THROWABLE=? where EVENT_ID=?
2006-03-06 10:19:17,738 DEBUG [org.hibernate.jdbc.AbstractBatcher] Executing batch size: 5


... nothing more until i kill the process, which seems freezed.

I saw on some other threads that there seemed to have pb between Oracle / Hibernate and LOBs.

So i tried to modify thr Runtime object to make is a transient (not persisted). Replaced :
Code:
   @Column(name="THROWABLE")
   @Lob
   public Throwable getThrowable() { return throwable; }
   public void setThrowable(Throwable throwable)
   {
      if(throwable instanceof Serializable)
         this.throwable = throwable;
   }

by
Code:
   @Transient
   public Throwable getThrowable() { return throwable; }
   public void setThrowable(Throwable throwable)
   {
      if(throwable instanceof Serializable)
         this.throwable = throwable;
   }


Now my code run ok , everytime, i can get any object , as much as i want. This makes me tell me that there seems to be a pb between Hibernate and Oracle 9i and LOBS.
To sum up for me :
- Oracle 10g with LOB => OK
- Oracle 9i with LOB => Strange freeze problems when batch updating.

I don't know if i make something wrong, well, i just wanted to report that "bug".

Nicolas.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 07, 2006 3:49 am 
Newbie

Joined: Mon Mar 06, 2006 7:25 am
Posts: 10
Hi,

I forgot to say that both test i've done on Oracle 10g or 9i were made using the same jdbc driver, the 10gR2 version.

So i tried the 9i test with the 9i JDBC driver. Then I got a "java.sql.SQLException: operation interdite: streams type cannot be used in batching" exception.
By reading other threads on the forum i found out that setting hibernate.jdbc.batch_size=0 could be the solution.

I tried it, ..... and it seems to work, i mean, the update no more freezes JBOSS. Now i have to see if all my object fields are correctly updated, event the LOB one.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.