Hi All, I need save class, but that class have inside Recursion of same class.

@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class BasicLinker implements LinkerAccess, Serializable{

    private static final long serialVersionUID = -9016733711922070564L;

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

    @Persistent private String name = "";
    @Persistent private String label = "";
    @Persistent private String urlItem = "";
    @Persistent private boolean customUrl = false;
    @Persistent private boolean isdefault = false;
    @Persistent private boolean asSubpage = false;
    @Persistent ArrayList<BasicLinker> sublinkers = new
ArrayList<BasicLinker>();
    @Persistent ArrayList<BasicData> subData = new ArrayList<BasicData>();
}

@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class BasicData implements DataAccess, Serializable{

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

    private static final long serialVersionUID = 1L;
    @Persistent private String propertyType = "";
    @Persistent private String propertyName = "";
}

when I wont save first instance of class BasicLinker , and then have
inside other instances of BasicLinker , then nothings is saved. I try
save it here :

public class ServerServiceImpl extends RemoteServiceServlet implements
ServerService{
    @Override
    public String save(BasicLinker basicLinker) {
        PersistenceManager pm = PMF.get().getPersistenceManager();
        try {
          pm.makePersistent(basicLinker);
        } finally {
          pm.close();
        }
        System.out.println(basicLinker.getId());
        return basicLinker.getId();
    }
but null is returned and nothing is saved.
when I delete line '@Persistent ArrayList sublin...' from BasicLinker
, then basic instance of BasicLinker an subData is saved successfully.
whot I can do ?
thanks

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

Reply via email to