Spring + hibernate + tapestry is a new popular Java development framework. This article provides an example of processing the orcale blob field content under this development framework:
Orcale blob database ing in Hibernate is private byte [] ZP; // photo "ZP" blob, which is used to store employee photos.
/** @ Hibernate. Property
* Column = "ZP"
* Type = "byte []"
* Not-null = "false"
* Unique = "false"
* Lazy = "false"
* @ Return
**/
Public byte [] getzp (){
Return ZP;
}
Public void setzp (byte [] ZP ){
This. ZP = ZP;
}
Use the upload control of typestry to upload an image file and save it to the ZP field of orcale blob.
Public abstract iuploadfile GetFile ();
Private void uploadfile () throws exception {
If (stringutils. isblank (GetFile (). getfilename ())){
// Throw new pddtrunexception ("Select Upload File ");
} Else {
Byte BT [] = new byte [(INT) GetFile (). getsize ()];
GetFile (). getstream (). Read (BT );
(Ygbo) getitem (). setzp (BT );
}
}
Finally, save ygbo.