Process the orcale blob field content in the spring + hibernate + tapestry development framework

Source: Internet
Author: User

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.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.