You're using two separate transactions here: one to save the first file, and a second one to save the second file. So the first one is already committed when the second one rollbacks.
If you want the two saves to be part of the same transaction, then you should call a single transaction method from main, and save the two files from this method:
public static void main( String[] args ) throws Exception{
ApplicationContext appContext = new ClassPathXmlApplicationContext( "classpath:webConfiguration/applicationContext.xml");
FileBo aFileBo = (FileBo) appContext.getBean("fileBo");
// Data are ok, there is an insert.
File aFile = File (6778687,".bam");
File anAnotherFile = File (6567887,".pdf");
aFileBo.save(aFile, anotherFile);
}
public class FileBoImpl implements FileBo {
FileDao fileDao;
// ...
@Transactional
public void save(com.clb.genomic.lyon.model.File aFile,
com.clb.genomic.lyon.model.File bFile) {
fileDao.save(aFile);
fileDao.save(bFile);
}
}