users
[Top] [All Lists]

Spring, Hibernate, Oracle Blob's BLOB's

To: <users@xxxxxxxxxx>
Subject: Spring, Hibernate, Oracle Blob's BLOB's
From: "Ford, Eric" <EFord@xxxxxxxxxxx>
Date: Thu, 30 Sep 2004 09:54:58 -0400
Delivered-to: mailing list users@cinjug.org
Mailing-list: contact users-help@cinjug.org; run by ezmlm
Thread-index: AcSm9RJg3T1WrXOnSwCGzUMFiARVuQ==
Thread-topic: Spring, Hibernate, Oracle Blob's BLOB's
Given the following environment:

App Server: Weblog 8.1 SP3
DB: Oracle 9i
Spring: 1.1
Hibernate: 2.1.6


Has anyone come up with an elegant way of reading and writing Blob's or
BLOB's?

I am currently using a technique posted on the Hibernate website at:
http://www.hibernate.org/56.html. I am using the 2nd method and not the
3rd UserType method as I was having trouble getting that to work.

The problem I seem to be running into elegance wise is that I have the
Hibernate dependencies encapsulated at the DAO layer yet I cannot seem
to figure if there is a way to turn on 'cascade="all"' in a two-way
dependency without putting knowledge of Hibernate in the BO. Using this
technique alse requires that I set up the transactions and sessions
outside of the Spring framework and work directly with the Hibernate
framework


Example:

+---------+               +--------+
|         |1..1      0..n |        |
|Guideline|-------------->|Document|
|         |               |        |
+---------+               +--------+


Xdoclet:

In Guideline.java

/**
* @hibernate.set
*            name="documents"
*            table="DOCUMENT"     
*            cascade="delete"          <=========want to use
all-delete-orphan
*            lazy="true"     
*            inverse="true"     
*
* @hibernate.collection-key
*            column="guideline_id"
*      
* @hibernate.collection-one-to-many 
*            class="Document"
*
*/

In Document.java

/**
* A Guideline can contain many documents. However each document
* can belong to only one guideline (i.e. a many-to-one relationship).
* 
* @hibernate.many-to-one
*            class = "Guideline"
*            column = "guideline_id" not-null = "true"
*            cascade = "all"
*/

/**
* @hibernate.property
*            column = "file"
*            type = "blob"
*            not-null = "true"
*/
public Blob getFile() {
    return file;
}

public void setFile(Blob inFile) {
    this.file = inFile;
}



<Prev in Thread] Current Thread [Next in Thread>
  • Spring, Hibernate, Oracle Blob's BLOB's, Ford, Eric <=