Package models

Examples of models.Album.save()


     */
    private static void saveAlbumJson() {
        Gson gson = new Gson();
        Album album = gson.fromJson(new InputStreamReader(request.body), Album.class);
        album.replaceDuplicateArtist();
        album.save();
    }

    /**
     * Save album via XML API
     */
 
View Full Code Here


        Genre genreEnum = Genre.valueOf(genre.toString().toUpperCase());
        album.genre = genreEnum;

        //save in db
        album.artist = artist;
        album.save();
    }

    /**
     * @param id
     */
 
View Full Code Here

    public void testUniqueArtist() {
        Artist artist1 = new Artist("john");
        Album album1 = new Album("coolAlbum");
        album1.artist=artist1;
        album1.replaceDuplicateArtist();
        album1.save();
        // name must be unique
        Artist artist2 = new Artist("john");
        Album album2 = new Album("coolAlbum2");
        album2.artist=artist2;
        album2.replaceDuplicateArtist();
View Full Code Here

        // name must be unique
        Artist artist2 = new Artist("john");
        Album album2 = new Album("coolAlbum2");
        album2.artist=artist2;
        album2.replaceDuplicateArtist();
        album2.save();
        // check artist is unique
        assertEquals(Artist.find("byName", "john").fetch().size(),1);
    }

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.