Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:
2.1.8
Code between sessionFactory.openSession() and session.close():
Session saveSession = getDedicatedSession();
ai.setAttach(Hibernate.createBlob(new String(" ").getBytes()));
saveSession.save(ai);
saveSession.flush();
saveSession.close();
saveSession = getDedicatedSession();
AttachmentInfo attachmentInfo = (AttachmentInfo)saveSession.load(AttachmentInfo.class,new Integer(ai.getAttachID()),LockMode.UPGRADE);
oracle.sql.BLOB blob = (oracle.sql.BLOB) attachmentInfo.getAttach();
OutputStream os = blob.getBinaryOutputStream();
os.write(attachObject);
os.close();
saveSession.close();
Name and version of the database you are using:
Oracle 9i
Hi
I have searched the forum, but couldnt get what i desired.
I need to support DB2 and SQL server too, Currently i am using Blob for Oracle i.e)
oracle.sql.BLOB blob = (oracle.sql.BLOB) attachmentInfo.getAttach();
Can i make this retrivel generic with out hardcoding the import i.e)
oracle.sql.BLOB
Waiting for replies
Thanks team