public void testManyToOneGenerics() throws Exception { Paper white = new Paper(); white.setName("WhiteA4"); PaperType type = new PaperType(); type.setName("A4"); SomeGuy me = new SomeGuy(); white.setType(type); white.setOwner(me); Price price = new Price(); price.setAmount(new Double(1)); price.setCurrency("Euro"); white.setValue(price); Session s = openSession(); Transaction tx = s.beginTransaction(); s.persist(type); s.persist(price); s.persist(me); s.persist(white); tx.commit(); // s.close(); s = openSession(); tx = s.beginTransaction(); white = (Paper) s.get(Paper.class, white.getId()); s.delete(white.getType()); s.delete(white.getOwner()); s.delete(white.getValue()); s.delete(white); tx.commit(); // s.close(); }