Results 1 to 2 of 2

Thread: MappingException:No persister for: net.sf.hibernate.lob.Blob

  1. #1

    Default MappingException:No persister for: net.sf.hibernate.lob.Blob

    Hibernate version:
    2.1.6

    Mapping documents:
    <class
    name="com.xxx.bean.Email"
    table="EMAILS"
    dynamic-update="true"
    dynamic-insert="true"
    >
    <id
    name="emailId"
    type="long"
    column="EMAIL_ID"
    length="22"
    >
    <generator class="native"/>
    </id>

    <property
    name="emailattachment"
    type="java.lang.Object"
    update="false" insert="false" >
    <column name="EMAIL_ID" />
    <column name="EMAILATTACHMENT"/>
    </property>

    Code between sessionFactory.openSession() and session.close():
    InputStream is = new FileInputStream((File)email.getEmailattachment());
    byte[] data = new byte[is.available()];
    is.read(data);
    is.close();

    email.setEmailattachment((Object)Hibernate.createB lob(byte[1]));
    getHibernateTemplate().save(o);
    getHibernateTemplate().flush();
    getHibernateTemplate().refresh(o, LockMode.UPGRADE);
    writeBlob(data,(Blob)email.getEmailattachment());

    protected final void writeBlob(byte[] data, Blob l_blob) throws Exception {
    OutputStream out = ((oracle.sql.BLOB) l_blob).getBinaryOutputStream();
    out.write(data);
    out.close();
    }


    Full stack trace of any exception that occurs:
    java.lang.RuntimeException: java.lang.RuntimeException: org.springframework.orm.hibernate.HibernateSystemE xception: No persister for: net.sf.hibernate.lob.BlobImpl; nested exception is net.sf.hibernate.MappingException: No persister for: net.sf.hibernate.lob.BlobImpl
    Name and version of the database you are using:
    Oracle 9

    I am trying to cast an java.lang.Object as a Blob and gives me this Exception. Any help is appreciated.

  2. #2
    Join Date
    Aug 2004
    Location
    Montréal, Canada
    Posts
    845

    Default

    Omar Irbouh

    Spring Modules Team
    http://irbouh.blogspot.com/

Similar Threads

  1. Replies: 2
    Last Post: Sep 20th, 2005, 01:39 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •