Announcement Announcement Module
Collapse
No announcement yet.
MappingException:No persister for: net.sf.hibernate.lob.Blob Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    :!:
    Thread on Hibernate Forums

    Comment

    Working...
    X