}
@Test
@TestForIssue(jiraKey = "OGM-612")
public void canUseObjectIdAssignedUponInsertWithNestedEmbeddable() {
OgmSession session = openSession();
Transaction tx = session.beginTransaction();
// given
EntityWithObjectIdAndEmbeddable entity = new EntityWithObjectIdAndEmbeddable();
AnotherEmbeddable anotherEmbeddable = new AnotherEmbeddable( "Another nice string ... nested" );
AnEmbeddable anEmbeddable = new AnEmbeddable( "a very nice string", anotherEmbeddable );
entity.setAnEmbeddable( anEmbeddable );
// when
session.persist( entity );
tx.commit();
session.clear();
tx = session.beginTransaction();
EntityWithObjectIdAndEmbeddable loaded = (EntityWithObjectIdAndEmbeddable) session.load( EntityWithObjectIdAndEmbeddable.class, entity.getId() );
// then
assertThat( loaded.getId() ).isEqualTo( entity.getId() );
assertThat( loaded.getAnEmbeddable().getEmbeddedString() ).isEqualTo( entity.getAnEmbeddable().getEmbeddedString() );
assertThat( loaded.getAnEmbeddable().getAnotherEmbeddable().getEmbeddedString() ).isEqualTo(
entity.getAnEmbeddable().getAnotherEmbeddable().getEmbeddedString() );
tx.commit();
session.close();
}