5657585960616263646566
File file = new File(); file.setName(name); file.setContentType(contentType); file.setFileSize(size); if (data != null) { file.setData(new BlobImpl(data, (int)size)); } ThreadSession.get().save(file); directory.getFiles().add(file); return file; }
293031323334353637
private static void createFile(Session session, Directory d, String name) throws HibernateException { File f1 = new File(); f1.setContentType("text/plain"); f1.setName(name); f1.setData(new BlobImpl("DATA".getBytes())); session.save(f1); d.getFiles().add(f1); }