/** Changes the parent LocationGroup's name to "Airport" */ private void updateLocationGroupName(FullTextSession fullTextSession) { final Transaction transaction = fullTextSession.beginTransaction(); LocationGroup group = (LocationGroup) fullTextSession.get(LocationGroup.class, 1L); LocationGroup locationGroup = (LocationGroup) fullTextSession.merge(group); locationGroup.setName("Airport"); transaction.commit(); }
/** * Initialize the test data. * * @param fulltextSessionBuilder */ private void initializeData(FullTextSessionBuilder fulltextSessionBuilder) { FullTextSession fullTextSession = fulltextSessionBuilder.openFullTextSession(); try { final Transaction transaction = fullTextSession.beginTransaction(); LocationGroup group = new LocationGroup("Floor 1"); fullTextSession.persist(group); for (int i = 0; i < 5; i++) { Location location = new Location("Room 10" + i); fullTextSession.persist(location); group.getLocations().add(location); location.setLocationGroup(group); fullTextSession.merge(group); } transaction.commit(); } finally { fullTextSession.close(); } }