Session session = ...;
Transaction transaction = session.beginTransaction();
Parent parent1 = new Parent();
parent1.name = "Parent 1";
Child child1 = new Child();
child1.properties.put( "some_setting", "a value" );
child1.properties.put( "another_setting", "another value" );
child1.properties.put( "yet_another_setting", "another value" );
parent1.children.add( child1 );
session.persist( parent1 );
transaction.commit();
session.clear();
transaction = session.beginTransaction();
Parent loaded = session.get( Parent.class, parent1.id );
assertEquals( 1, loaded.children.size() );
transaction.commit();
session.close();