-->
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.  [ 3 posts ] 
Author Message
 Post subject: Where is http://www.hibernate.org/56.html ? Oracle Blob
PostPosted: Fri Jul 15, 2011 3:03 pm 
Newbie

Joined: Fri Jul 15, 2011 1:27 pm
Posts: 2
I am experiencing a ORA-01460: unimplemented or unreasonable conversion requested exception when attempting to insert files that are larger than 4k.

I am using Oracle 11g with ojdbc6.jar. (I've tried ojdbc14.jar and ojdbc5.jar with same results)

I keep seeing references to http://www.hibernate.org/56.html which is supposed to hold the key to resolving this issue. However, that link is dead.
Can anyone provide us (the community) with the updated link to this information?

More info on my project:

I have an entity where files are being inserted into a column of type Oracle BLOB. This is that class:
Code:
package com.dao.entity;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.JoinColumn;
import javax.persistence.Table;
import javax.persistence.Temporal;
import org.hibernate.annotations.GenericGenerator;

@Entity
@Table(name="project_report_docs")
public class Project_Report_Doc implements Serializable {
   
    @Id
    @GeneratedValue(generator="auto_increment")
    @GenericGenerator(name="auto_increment", strategy="increment")
    @Column(name="doc_id")
    private int doc_id;
   
    @ManyToOne
    @JoinColumn(name="report_id")
    private Project_Report project_report;
   
    @ManyToOne
    @JoinColumn(name="account_id")
    private Account account;
   
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date doc_date;
   
    @Lob
    private byte[] document;
   
    private String extension;

    public Date getDoc_date() {
        return doc_date;
    }

    public void setDoc_date(Date doc_date) {
        this.doc_date = doc_date;
    }

    public int getDoc_id() {
        return doc_id;
    }

    public void setDoc_id(int doc_id) {
        this.doc_id = doc_id;
    }

    public byte[] getDocument() {
        return document;
    }

    public void setDocument(byte[] document) {
        this.document = document;
    }

    public Account getAccount() {
        return account;
    }

    public void setAccount(Account account) {
        this.account = account;
    }

    public Project_Report getProject_report() {
        return project_report;
    }

    public void setProject_report(Project_Report project_report) {
        this.project_report = project_report;
    }

    public String getExtension() {
        return extension;
    }

    public void setExtension(String extension) {
        this.extension = extension;
    }

}


Here is my hibernate.cfg.xml:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
  <session-factory>

    <!-- Hibernate Settings -->
        <property name="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</property>
        <property name="hibernate.connection.driver_class">oracle.jdbc.OracleDriver</property>
       
        <property name="hibernate.default_schema">x_xxxx</property>
        <property name="hibernate.connection.username">x_xxxxxxxx_xxxxxx</property>
        <property name="hibernate.connection.password">xxxxxxxxxxxxxxxxxxxxxxxxxxx</property>
        <!--property name="hibernate.jdbc.batch_size">20</property-->
        <property name="hibernate.jdbc.batch_size">0</property>
        <property name="hibernate.transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</property>
        <property name="hibernate.current_session_context_class">thread</property>
        <property name="hibernate.jdbc.use_streams_for_binary">true</property>
        <property name="hibernate.connection.url">jdbc:oracle:thin:@xxx.xxx.xxx.xxx:1521:x_xxx</property>
       
       
    <!-- /Hibernate Settings -->

    <!-- C3P0 Settings -->
    <!-- ** Information on C3P0 can be found at http://www.mchange.com/projects/c3p0/index.html ** -->
        <property name="hibernate.connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</property>
        <property name="hibernate.c3p0.max_size">100</property>
        <property name="hibernate.c3p0.acquire_increment">1</property>
        <property name="hibernate.c3p0.idle_test_period">100</property> <!-- seconds -->
        <property name="hibernate.c3p0.max_statements">0</property>
        <property name="hibernate.c3p0.min_size">10</property>
        <property name="hibernate.c3p0.timeout">1000</property> <!-- seconds -->
        <property name="hibernate.show_sql">false</property> <!-- /show hibernate sql in tomcat log ;; use for debugging -->
    <!-- /C3P0 Settings -->

    </session-factory>
</hibernate-configuration>


Here is the code for inserting into the databse:
Code:
public static boolean mergeWithAttachment(Project_Report report, Project_Report_Doc report_doc) {
        boolean success = false;
        Session session = null;
        Transaction trans = null;
        try {
            session = HibernateUtil.getSession();
            trans = session.beginTransaction();
            report = (Project_Report) session.merge(report);
            report_doc.setProject_report(report);
            report_doc = (Project_Report_Doc) session.merge(report_doc);
            session.flush();
            trans.commit();
            success = true;
        } catch (Exception e) {
            try {
                trans.rollback();
            } catch (Exception exc) {}
            Logger.append(source_name, e);
        } finally {
            if (!(trans.wasCommitted())) {
                session.flush();
                trans.commit();
            }
            if (session.isOpen()) {
                session.close();
            }
        }
        return success;
    }


I appreciate any help with resolving this issue. Thanks!


Top
 Profile  
 
 Post subject: Re: Where is http://www.hibernate.org/56.html ? Oracle Blob
PostPosted: Mon Jul 18, 2011 3:15 am 
Regular
Regular

Joined: Thu May 07, 2009 5:56 am
Posts: 94
Location: Toulouse, France
I couldn't find the FAQ on the new hibernate site but I usually use the "Wayback Machine" site to recovery link like this.
http://web.archive.org/web/200902242151 ... rg/56.html

_________________
everything should be made as simple as possible, but not simpler (AE)


Top
 Profile  
 
 Post subject: Re: Where is http://www.hibernate.org/56.html ? Oracle Blob
PostPosted: Tue Jul 19, 2011 9:44 am 
Newbie

Joined: Fri Jul 15, 2011 1:27 pm
Posts: 2
hallmit wrote:
I couldn't find the FAQ on the new hibernate site but I usually use the "Wayback Machine" site to recovery link like this.
http://web.archive.org/web/200902242151 ... rg/56.html


Thank you. I'm researching the content of that page. Hopefully I will have a solution to post in the near future.


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