Hi

I have tried persisting hard coded values on to the data store but
when i have a look at the data store viewer the values comes out to be
different.This is the sample code i have used
The Class is

package com.rmsi.lim.gstcloud.shared;

import javax.jdo.annotations.ForeignKey;
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import com.google.gwt.user.client.rpc.IsSerializable;
@PersistenceCapable(identityType = IdentityType.APPLICATION,
detachable = "false")
public class Districts implements IsSerializable
{
        @PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    private Long districtId;

        //@ForeignKey
        @Persistent
        private Long stateId;

    @Persistent
    private String districtName;

    @Persistent
    private Double latitude;

    @Persistent
    private Double longitude;

    public Districts()
    {

    }

    public Districts(Long stateId,String districtName,Double latitude,
Double longitude)
    {
        this.stateId = stateId;
        this.districtName = districtName;
        this.latitude=latitude;
        this.longitude=longitude;
    }

    public Long getDistrictId()
    {
        return districtId;
    }

    public long getStateId()
    {
        return stateId;
    }

    public String getDistrictName() {
        return districtName;
    }

    public Double getLatitude() {
        return latitude;
    }

    public Double getLongitude() {
        return longitude;
    }

    public void setDistrictId(Long districtId)
    {
        this.districtId = districtId;
    }

    public void setStateId(Long stateId)
    {
        this.stateId = stateId;
    }

    public void setDistrictName(String stateName) {
        this.districtName = stateName;
    }

    public void setLatitude(Double latitude) {
        this.latitude = latitude;
    }

    public void setLongitude(Double longitude) {
        this.longitude = longitude;
    }
}



private void DistrictsLoader()
        {
                 final Districts d1 = new Districts(new Long(1792),"Mukerjee 
Nagar",
28.5332740008773,77.1380750260011);
                 final Districts d2 = new Districts(new Long(1792),"Quila Rai
Pithora",28.5332740008995,77.1380750260022);
                 final Districts d3 = new Districts(new Long(1792),"Mehrauli",
28.5332740009000,77.1380750260000);
                 final Districts d4 = new Districts(new Long(1791),"Varanasi",
21.5340600313233,70.1421779768092);
                 final Districts d5 = new Districts(new Long(1788),"Bombay",
35.5642880083333,72.1446790266515);
                 final Districts d6 = new Districts(new Long(1790),"Ernakulam
(Cochin)",25.5133780333045,74.18106301263);
                 final Districts d7 = new Districts(new Long(1790),"Kannur",
25.5133780334049,74.18106301234);
                 final Districts d8 = new Districts(new Long(1787),"Amritsar",
18.5143749910063,76.1810389731092);
                 final Districts d9 = new Districts(new Long(1787),"Ludhiana",
18.5143749910101,76.1810389731022);
                 final Districts d10 = new Districts(new Long(1789),"Kaithal",
14.5162509923103,78.1837590156439);
                 final Districts d11 = new Districts(new Long(1794),"Vasco",
10.5187349935866,80.1808049982944);
                 final Districts d12 = new Districts(new Long(1795),"Leh 
Ladakh",
12.5274640137745,82.1808369601841);
                 final Districts d13 = new Districts(new Long(1795),"Srinagar",
30.5241309782258,79.1854310131575);
                 final Districts d14 = new Districts(new Long(1795),"Jammu",
30.5241309782258,79.1854310131575);
                 final Districts d15 = new Districts(new Long(1793),"Ahemdabad",
30.5241309782258,79.1854310131575);
                 final Districts d16 = new Districts(new Long(1793),"Vadodra",
30.5241309782258,79.1854310131575);

                 final AsyncCallback geoCallBack= new AsyncCallback<String>()
                        {
                                public void onFailure(Throwable caught)
                                {
                                        //System.out.println("failure");
                                }

                                public void onSuccess(String result)
                                {
                                        System.out.println("success");
                                }
                        };
                        dea.loadDistricts(d1, geoCallBack);
                        dea.loadDistricts(d2, geoCallBack);
                        dea.loadDistricts(d3, geoCallBack);
                        dea.loadDistricts(d4, geoCallBack);
                        dea.loadDistricts(d5, geoCallBack);
                        dea.loadDistricts(d6, geoCallBack);
                        dea.loadDistricts(d7, geoCallBack);
                        dea.loadDistricts(d8, geoCallBack);
                        dea.loadDistricts(d9, geoCallBack);
                        dea.loadDistricts(d10, geoCallBack);
                        dea.loadDistricts(d11, geoCallBack);
                        dea.loadDistricts(d12, geoCallBack);
                        dea.loadDistricts(d13, geoCallBack);
                        dea.loadDistricts(d14, geoCallBack);
                        dea.loadDistricts(d15, geoCallBack);
                        dea.loadDistricts(d16, geoCallBack);
        }

Implementation Method

             public String loadDistricts(Districts district)
        {
                try{
                        pm.makePersistent(district);
                   } finally
                        {
                        }

                return null;
        }


The value of the stateId in the datastore for all the 16 districts are
coming different..Kindly help

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appeng...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to