Joined: Thu Oct 01, 2009 7:47 am Posts: 1
|
Hi
i need to fetch the Blob from the oracle data base. we have stored the text string in it.i want to read it in java. Please help me regarding the issue.
I have done the following to query the data from oracle using HQL.
Mapped the table columns i need. contact.hbm.xml
<class name=""roseindia.tutorial.hibernate.Contact"" table="CONTACT"> <id name="transaction_id" type="long" column="TRANSACTION_ID" > <generator class="assigned"/> </id>
<property name="additional_info" type="binary"> <column name="ADDITIONAL_INFO" sql-type="blob"/> </property> </class>
Class file for java object import java.sql.Blob; public class Contact {
private Blob additional_info;
public Blob getAdditional_info() { return additional_info; } public void setAdditional_info(Blob additional_info) { this.additional_info = additional_info; } }
HQL QUERY List Contact = session.createSQLQuery("select {ins.*} from Contact ins ").addEntity("ins",Contact).list();
for (Iterator it = Contact.iterator(); it.hasNext();) { Contact contactObject = (Contact) it.next(); System.out.println("ID: " + contactObject.getAdditional_info()); }
Out Put: ID:[B@458f41 ID:[B@1f01a29
I am getting following output.please tell me how i can read the text.
|
|