I would like to know how can I access the file system from an EJB 3 bean?
I searched the Internet on the subject and haven't found a good answer.
Some suggest using the java.io/java.nio even though the specification prohibits this usage. Most application servers seem to allow the access to this API anyway.
Another idea would be to use an JCA connector to access the file system or a LDAP directory.
What I want to do this to avoid the use of BLOB in the database when a simple file would be a much better solution in terms of performance and used resources.
How would you solve this problem?
If you know you will never cluster your application (or that you will be able to network-map the drive) then just use java.io.*.
Be sure to introduce proper configuration regarding the root location of your files storage.
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