Package com.github.jmkgreen.morphia.testdaos

Examples of com.github.jmkgreen.morphia.testdaos.HotelDAO.findOne()


        Hotel hotelLoaded = hotelDAO.get(borg.getId());
        assertEquals(borg.getName(), hotelLoaded.getName());
        assertEquals(borg.getAddress().getPostCode(), hotelLoaded.getAddress().getPostCode());

        Hotel hotelByValue = hotelDAO.findOne("name", "Hotel Borg");
        assertNotNull(hotelByValue);
        assertEquals(borg.getStartDate(), hotelByValue.getStartDate());

        assertTrue(hotelDAO.exists("stars", 4));
View Full Code Here


        assertEquals(2, allHotels.size());

        assertEquals(1, hotelDAO.find(hotelDAO.createQuery().offset(1).limit(10)).asList().size());
        assertEquals(1, hotelDAO.find(hotelDAO.createQuery().limit(1)).asList().size());
        assertTrue(hotelDAO.exists("type", Hotel.Type.BUSINESS));
        assertNotNull(hotelDAO.findOne("type", Hotel.Type.LEISURE));

        // try updating
        UpdateOperations<Hotel> mods = hotelDAO.createUpdateOperations().inc("stars", 1);
        hotelDAO.update(hotelDAO.createQuery().filter("stars", 4), mods);
        assertEquals(2, hotelDAO.count(hotelDAO.createQuery().filter("stars", 5)));
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.