Package org.mongodb.morphia.testdaos

Examples of org.mongodb.morphia.testdaos.HotelDAO.save()


        address.setStreet("Posthusstraeti 11");
        address.setPostCode("101");
        borg.setAddress(address);

        final HotelDAO hotelDAO = new HotelDAO(getMorphia(), getMongoClient());
        hotelDAO.save(borg);
        assertEquals(1, hotelDAO.count());
        assertNotNull(borg.getId());

        final Hotel hotelLoaded = hotelDAO.get(borg.getId());
        assertEquals(borg.getName(), hotelLoaded.getName());
View Full Code Here


        final Address hiltonAddress = new Address();
        hiltonAddress.setStreet("Some street 44");
        hiltonAddress.setPostCode("101");
        hilton.setAddress(hiltonAddress);

        hotelDAO.save(hilton);

        final List<Hotel> allHotels = hotelDAO.find().asList();
        assertEquals(2, allHotels.size());

        assertEquals(1, hotelDAO.find(hotelDAO.createQuery().offset(1).limit(10)).asList().size());
View Full Code Here

        final HotelDAO hotelDAO = new HotelDAO(getMorphia(), getMongoClient());

        final Hotel borg = new Hotel();
        borg.setName("Hotel Borg");
        borg.setStars(4);
        hotelDAO.save(borg);

        final Hotel hotelLoaded = hotelDAO.get(borg.getId());
        hotelLoaded.setStars(5);
        hotelDAO.save(hotelLoaded);
        final Hotel hotelReloaded = hotelDAO.get(borg.getId());
View Full Code Here

        borg.setStars(4);
        hotelDAO.save(borg);

        final Hotel hotelLoaded = hotelDAO.get(borg.getId());
        hotelLoaded.setStars(5);
        hotelDAO.save(hotelLoaded);
        final Hotel hotelReloaded = hotelDAO.get(borg.getId());
        assertEquals(5, hotelReloaded.getStars());
    }
}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.