ebean映射到BYTEA的数据类型是什么? [英] What data type does ebean map to BYTEA?
问题描述
我应该使用一些类型 Blob
?或者只是一个 byte []
?还是有另一种数据类型,我应该使用?谢谢!
使用Ebean创建blob,您需要使用带有@Lob注释的字节数组
@Lob
public byte [] image;
您需要在File<>字节数组之间转换,所以也许更容易文件系统中的文件? (除了在FS中存储文件只是比在DB中便宜)
I have a Play! 2.0.2 application that needs to store some files in the database. we are using Ebean for our ORM. I believe I need a BYTEA column in my database to store the file, but I'm not sure what data type to use in my model.
Should I be using some kind of Blob
? Or just a byte[]
? Or is there another data type I should be using? Thanks!
To create blob with Ebean you need to use byte array with @Lob annotation
@Lob
public byte[] image;
You'll need to convert between File <-> byte array, so maybe it's easier to store files in filesystem? (besides storing files in FS is just cheaper than in DB)
这篇关于ebean映射到BYTEA的数据类型是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!