Package com.google.appengine.api.datastore.KeyFactory

Examples of com.google.appengine.api.datastore.KeyFactory.Builder


        try {
            em = emf.createEntityManager();

            // An entity with a Key ID field. Can have an ancestor set
            // in the Key.
            Key book3key = new Builder("Publisher", "O'Reilly")
                .addChild("BookKeyId", "978-0-596-52272-8")
                .getKey();
            BookKeyId book3 = new BookKeyId(book3key);
            em.persist(book3);

        } finally {
            em.close();
        }

        try {
            em = emf.createEntityManager();

            // An object with its entity's key encoded as two String
            // fields, one for the object's kind and (string or
            // numeric) ID, and one for the parent.  (The class
            // constructor calls KeyFactory.keyToString() to encode
            // the Key values.  See BookEncodedStringId.java.)
            Key book4keyParent = new Builder("Publisher", "O'Reilly").getKey();
            Key book4key = new Builder("BookEncodedStringId", "978-0-596-52272-8")
                .getKey();
            BookEncodedStringId book4 = new BookEncodedStringId(book4key,
                                                                book4keyParent);
            em.persist(book4);
View Full Code Here

TOP

Related Classes of com.google.appengine.api.datastore.KeyFactory.Builder

Copyright © 2018 www.massapicom. 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.