@Autowired
private SessionFactory sessionFactory;
private Label givenLabelStored() {
Label label = Label.create("label-code-" + UUID.randomUUID(),
"labelName " + UUID.randomUUID().toString());
LabelType labelType = LabelType.create("label-type-"
+ UUID.randomUUID());
labelType.addLabel(label);
labelTypeDAO.save(labelType);
labelTypeDAO.flush();
sessionFactory.getCurrentSession().evict(labelType);
sessionFactory.getCurrentSession().evict(label);
labelType.dontPoseAsTransientObjectAnymore();
label.dontPoseAsTransientObjectAnymore();
return label;
}