My J2EE application has to access data stored in a database and also binary data which is usually stored as files (it can be several MBs for each piece of binary data).
Is it possible to store the files in the database as binary data using CMP, or it is not advisable to use a database to store binary data? Should I build a layer around EJB for file handling because it is not allowed to do any file IO in EJB?
I do not know which option I should use.
The best choice of storage is probable a matter of taste.
In general a DB is just access to a file, so storing binary data as BLOBs
should be fine in most cases.
If you have the data in files already and you want to access it inside
your j2ee application, you could always try to use an MBean
(threads and files allowed).
JBoss has an RMI Invoker Adaptor to MBeans.