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)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With