jpa 中的大型二进制文件
我在 GF3 服务器和远程 swing 客户端上有 ejb + JPA 应用程序。我想通过无状态会话 bean 将大文件从客户端上传到服务器的数据库。 如何从远程 Swing 客户端上传大型二进制数据?
I have ejb + JPA app on GF3 server and remote swing client. I want upload large files from client to server's database over stateless session bean.
how to upload large binary data from remote swing client?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在Entity Bean中,可以使用Blob字段类型&通过@Lob注释它可以将这些数据直接保存到数据库中。
//-- 编辑部分
对于如此大的文件,您可以将文件内容提取到固定大小的字节数组中,这样客户端就不会耗尽内存。
客户端:
服务器端:
In Entity Bean, you can use Blob field type & annotate it by @Lob to persist such data directly into database.
//-- Edit Part
For such a large file, you can fetch the file contents into byte array of fixed size such that client won't run out of memory.
Client side:
Server side: