I'm confused.

My class Login of persistence is:
---------------------------------------------------------------
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

@PersistenceCapable
public class Login {

        @PrimaryKey
        @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
        private Long id;

        @Persistent
        private String user;

        @Persistent
        private String password;

        public Login(String user, String password) {
                super();
                this.user = user;
                this.password = password;
        }

        public String getUser() {
                return user;
        }

        public void setUser(String user) {
                this.user = user;
        }

        public String getPassword() {
                return password;
        }

        public void setPassword(String password) {
                this.password = password;
        }

}
---------------------------------------------------------------------------------

So, I'm storing the Entity and automatic generating the ID. Right? If
true, my data should not double as is happening, right?

Thank you very much!

Rgds,
Caram.:

On 11 ago, 18:38, Ronmell Fuentes <[email protected]> wrote:
> yup, just in case the ID is not generated when storing the Entity.
> ;-)
> otherwise the ID 'd be generated every time the data'd be stored.
>
> 2010/8/11 Caram <[email protected]>
>
>
>
> > But, in
> >http://code.google.com/intl/en/appengine/docs/python/tools/uploadingd...
> > ,
> > he said:
>
> > "When data is downloaded, the entities are stored along with their
> > original keys. When the data is uploaded, the original keys are used.
> > If an entity exists in the datastore with the same key as an entity
> > being uploaded, the entity in the datastore is replaced.
>
> > You can use upload_data to replace the data in the app from which it
> > was dumped, or you can use it to upload the data to a different
> > application. Entities with numeric system IDs will be uploaded with
> > the same IDs, and reference properties will be preserved."
>
> > So, my ID of Login is Long, I understand that it should be updating
> > like he said above and not adding as is happening.
>
> > Am I right?
>
> > Thanks!
> > Caram.:
>
> > On 11 ago, 15:57, Ronmell Fuentes <[email protected]> wrote:
> > > Hi, ok.
> > > what happens is the following.
>
> > > As you already know, in DataStore there's no "update" because when you
> > > insert a record, depending on the Primary Key you have set in your, all
> > the
> > > new data just falls over the first records. This means, that if you are
> > > generating an ID every time an insert is done, this will keep until
> > always.
> > > jeje. But if for example you set a primary Key based on an field of your
> > > entity, for example you set
> > > Primary Key(MyField);  where MyField is a string name, this will create
> > > something like this.
> > > For MyField="helloworld1";
>
> > > MyEntity("helloworld1");
>
> > > For MyField="helloworld2";
>
> > > MyEntity("helloworld1");
>
> > > and so on...
>
> > > So that, the main point here is, when inserting a new record, and the
> > value
> > > of the Primary Key is not set by yourself, this will automatically create
> > a
> > > new record. All data will be inserted again and again.
>
> > > if you already have the ID=1;
> > > and you try to insert a new record with ID=1 and ID is the primary key,
> > then
> > > the record won't be inserted again, but will be updated.
>
> > > As you can see, all depends on the way you create your Entities or
> > Classes .
>
> > > Rgds.
>
> > > R. F.
>
> > > 2010/8/11 Caram <[email protected]>
>
> > > > Ronmell,
>
> > > > These days I study and I succeed in download data from datastore
> > > > in .csv.
> > > > I understand that I can modifiy this .csv and upload it to make the
> > > > changes in my datastore. But, when I try to upload it, duplicate in my
> > > > datastore all entities I have. It changes the ID to name, I've tried
> > > > many things unsuccessfully, can you help me?
>
> > > > Here my commands/codes:
>
> > > > bulkloader.yaml:
>
> > ---------------------------------------------------------------------------
> > --------------
> > > > # Autogenerated bulkloader.yaml file.
> > > > # You must edit this file before using it. TODO: Remove this line when
> > > > done.
> > > > # At a minimum address the items marked with TODO:
> > > > #  * Fill in connector and connector_options
> > > > #  * Review the property_map.
> > > > #    - Ensure the 'external_name' matches the name of your CSV column,
> > > > #      XML tag, etc.
> > > > #    - Check that __key__ property is what you want. Its value will
> > > > become
> > > > #      the key name on import, and on export the value will be the Key
> > > > #      object.  If you would like automatic key generation on import
> > > > and
> > > > #      omitting the key on export, you can remove the entire __key__
> > > > #      property from the property map.
>
> > > > # If you have module(s) with your model classes, add them here. Also
> > > > # change the kind properties to model_class.
> > > > python_preamble:
> > > > - import: base64
> > > > - import: re
> > > > - import: google.appengine.ext.bulkload.transform
> > > > - import: google.appengine.ext.bulkload.bulkloader_wizard
> > > > - import: google.appengine.api.datastore
> > > > - import: google.appengine.api.users
>
> > > > transformers:
>
> > > > - kind: Login
> > > >  connector: csv
>
> > > >  property_map:
> > > >    - property: __key__
> > > >      external_name: ID
> > > >      export_transform: transform.key_id_or_name_as_string
>
> > > >    - property: password
> > > >      external_name: password
>
> > > >    - property: user
> > > >      external_name: user
>
> > ---------------------------------------------------------------------------
> > ----------------------------------
>
> > > > For download:
> > > > appcfg.py download_data -e [email protected] --
> > > > config_file=bulkloader.yaml --kind=Login --filename=teste.csv --
> > > > url=http://pac-web.appspot.com/remote_api
>
> > > > Result (teste.csv):
>
> > ---------------------------------------------------------------------------
> > -------------------------------
> > > > password,ID,user
> > > > swdw,1,User
> > > > CARACA,1001,User
> > > > CARACA2,2001,User
> > > > ,3001,
> > > > edsed,4001,User
> > > > edsed,4002,User43
> > > > edsed,5001,User43
> > > > edsed,6001,User47
>
> > ---------------------------------------------------------------------------
> > -------------------------------
>
> > > > For upload (result inhttps://appengine.google.com/datastore, kind
> > > > Login):
>
> > ---------------------------------------------------------------------------
> > -------------------------------
> > > > ID/Name  password        user
> > > >        id=1     swdw    User
> > > >        id=1001  CARACA  User
> > > >        id=2001  CARACA2         User
> > > >        id=3001  <null>  <null>
> > > >        id=4001  edsed   User
> > > >        id=4002  edsed   User43
> > > >        id=5001  edsed   User43
> > > >        id=6001  edsed   User47
> > > >        name=1   swdw    User
> > > >        name=1001        CARACA  User
> > > >        name=2001        CARACA2         User
> > > >        name=3001
> > > >        name=4001        edsed   User
> > > >        name=4002        edsed   User43
> > > >        name=5001        edsed   User43
> > > >        name=6001        edsed   User47
>
> > ---------------------------------------------------------------------------
> > -------------------------------
>
> > > > Rgds!
> > > > Caram.:
>
> > > > On 5 ago, 16:30, Ronmell Fuentes <[email protected]> wrote:
> > > > > jeje ok ok.
> > > > > In the doc related to python, there you can find information about
> > how to
> > > > > write your Exporter/Loader classes.
>
> > > > > Happy Codding.
>
> > > > > Rgds.
>
> > > > > R. F.
>
> > > > > 2010/8/5 Caram <[email protected]>
>
> > > > > > I would search about item 5 because I "traveled", understand
> > > > > > nothing... :)
>
> > > > > > Thanks!
>
> > > > > > On 5 ago, 15:45, Ronmell Fuentes <[email protected]> wrote:
> > > > > > > Ok.
> > > > > > > 1.  appcfg.py can be used whether your app is written in Java or
> > > > Python.
> > > > > > > 2.  when they speak about "remote_api" is right, you need to
> > write
> > > > some
> > > > > > > lines in your web.xml file to allow the connection remotely.
> > > > > > > 3.  when it's mentioned
> > > > > > > com.google.apphosting.utils.remoteapi.RemoteApiServlet  is the
> > name
> > > > of
> > > > > > the
> > > > > > > servlet which answer the request of connection, so that, you have
> > to
> > > > > > write
> > > > > > > the name of the servlet, and also have to map it to the URL where
> > the
> > > > > > tool
> > > > > > > is redirected when trying to connect.
>
> > > > > > > 4.  The app.yaml is a file which is written when developing an
> > app
> > > > made
> > > > > > in
> > > > > > > python, so at this point it's useless.
>
> > > > > > > 5. If you are going to use a tool such as appcfg.py or
> > bulkloader.py
> > > > you
> > > > > > > have to write some files in order to manage your data in
> > datastore.
> > > > This
> > > > > > is
> > > > > > > very important since when using the dataStore we have schemaless,
> > so
> > > > the
> > > > > > > tool doesn't know how to deal with data stored in datastore, thus
> > you
> > > > > > have
> > > > > > > to write a file for loading/downloading the data. These files
> > > > contains
> > > > > > the
> > > > > > > classes called Exporter/Loader. In google docs for GAE there is
> > > > > > information
> > > > > > > about this issue.
>
> > > > > > > 6.  Personally when I knew I had to deal with data stored in
> > > > DataStore
> > > > > >  of
> > > > > > > my App, I decided to build my own tool for doing this. I took the
> > > > > > > Service-Rest way. This means that I have a Service (Rest type)
> > > > listening,
> > > > > > > running on my app so that I can connect remotely to this service
> > and
> > > > tell
> > > > > > it
> > > > > > > to do pretty much whatever I want and what it was programmed for.
>
> > > > > > > There is an opensource product for this.http://www.restlet.org/
> > > > > > > this is the related documentation.
>
> >http://wiki.restlet.org/docs_2.0/13-restlet/21-restlet/318-restlet.html
>
> > > > > > > For me it works perfectly and it's not too difficult to
> > understand
> > > > the
> > > > > > > concept.
>
> > > > > > > Hope this is helpful.
> > > > > > > Rgds
>
> > > > > > > R. F.
> > > > > > > any doubt I'm always willing to help.
>
> > > > > > > 2010/8/5 Caram <[email protected]>
>
> > > > > > > > I'm confused!
>
> > > > > > > > I uploaded a Java app.
>
> > > > > > > > I installed Python 2.7 and GAE for Python to work with the
> > remote
> > > > > > > > database.
>
> > > > > > > > I'm following this link:
>
> > > >http://code.google.com/intl/en/appengine/docs/python/tools/uploadingd.
> > > > > > ..
> > > > > > > > but I'm confused because this article is for Python, not for
> > Java
> > > > app.
> > > > > > > > It have a tip in beginning:
>
> > > > > > > > "If you have a Java app, you can use the Python appcfg.py tool
> > by
> > > > > > > > installing the Java version of the remote_api handler, which is
> > > > > > > > included with the Java runtime environment. The handler servlet
> > > > class
> > > > > > > > is
>
> ...
>
> mais »

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to