Hi,

I'm getting a Null ArrayList<String> in a program i'm developing. For
testing purposes I created this really small example that still has
the same problem. I already tried diferent Primary Keys, but the
problem persists.

Any ideas or suggestions?


**1-Employee class**
@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class Employee {

    @PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    @Extension(vendorName="datanucleus", key="gae.encoded-pk",
value="true")
    private String key;

    @Persistent
    private ArrayList<String> nicks;

    public Employee(ArrayList<String> nicks) {
        this.setNicks(nicks);
    }

    public String getKey() {
        return key;
    }

        public void setNicks(ArrayList<String> nicks) {
                this.nicks = nicks;
        }

        public ArrayList<String> getNicks() {
                return nicks;
        }
}

**2-EmployeeService**
public class BookServiceImpl extends RemoteServiceServlet implements
EmployeeService {

        public void addEmployee(){

                ArrayList<String> nicks = new ArrayList<String>();
                nicks.add("name1");
                nicks.add("name2");

                Employee employee = new Employee(nicks);

                PersistenceManager pm = PMF.get().getPersistenceManager();
                try {
                        pm.makePersistent(employee);
                } finally {
                        pm.close();
                }
        }

        /**
         * @return
         * @throws NotLoggedInException
         * @gwt.typeArgs <Employee>
         */
        public Collection<Employee> getEmployees() {

                PersistenceManager pm = getPersistenceManager();

                try {
                        Query q = pm.newQuery("SELECT FROM " + 
Employee.class.getName());

                        Collection<Employee> list =
                                
pm.detachCopyAll((Collection<Employee>)q.execute());

                        return list;

                } finally {
                        pm.close();
                }
        }
}

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" 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-web-toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to