I had a bidirectional relationship in my one-to-one mapping, however I had forgotten to set the objects in my Java code to reference each other. Once I had done that, the problem was resolved.
SpermAnalysis sa = new SpermAnalysis();
cryoSession.getControlMouse().setSpermAnalysis(sa);
// Bidirectional relationship
sa.setMouse(cryoSession.getControlMouse());
Tips and experience about developing websites with various technologies
Wednesday, July 22, 2009
Determine Mime type from bytes
If you have an image file stored in the database but don't have the extension of the file, then you may not know what the mime type should be.
There is a handy Java library that will inspect the bytes to determine the Mime type. The library can be found here:
MimeUtil
It's fairly easy to use. An example code is shown below:
There is a handy Java library that will inspect the bytes to determine the Mime type. The library can be found here:
MimeUtil
It's fairly easy to use. An example code is shown below:
byte[] bytes;
MimeUtil.registerMimeDetector("eu.medsea.mimeutil.detector.MimeMagicMimeDetector");
MimeUtil.getMimeTypes(bytes);
MimeUtil.unregisterMimeDetector("eu.medsea.mimeutil.detector.MimeMagicMimeDetector");
Subscribe to:
Posts (Atom)