A simple groovy SSCCE demonstrates my lack of understanding with this issue:
Using the Equipment entity above:
Code:
List equipmentList = [
new Equipment(equipmentId:1, name:'one'),
new Equipment(equipmentId:2, name:'two')
]
sessionFactory = new AnnotationConfiguration().configure().buildSessionFactory();
Session session = sessionFactory.getCurrentSession();
session.beginTransaction()
equipmentList.each { equipment ->
session.save(equipment)
}
session.getTransaction().commit()
As reported I get:
Hibernate: insert into Equipment (name) values (?)
Hibernate: insert into Equipment (name) values (?)
but nothing is written to the database. If I remove the @GeneratedValue nothing gets saved but I don't get the above inserts.
I would really appreciate someone pointing this Hibernate rookie in the right direction.
Tom.