开发者

How does the Java Persistance API handle binary data?

I'm working on a CDN project in Java EE using the Java Per开发者_高级运维sistence API. As such, I'll need to store binary data.

How is that supported? Will I have to store a filename and do read and write operations separately, or can it handle binary data natively?


You can use the @Lob annotation as described here. The example uses a String but if you do like the below example it will store binary data as well.

@Lob 
public byte[] getBinaryData() {
    return binaryData;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜