Oh yes, ofcourse Employee extends Person...

On Jan 7, 5:31 pm, Kah0ona <[email protected]> wrote:
> I have a problem with the following things:
>
> @PersistenceCapable(detachable = "false", identityType =
> IdentityType.APPLICATION)
> @Inheritance(strategy = InheritanceStrategy.SUBCLASS_TABLE)
> public abstract class Person {
>
>         @PrimaryKey
>         @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
>         @Extension(vendorName = "datanucleus", key = "gae.encoded-pk", value
> = "true")
>         protected String id; //encoded string
>
> }
>
> public class Employee {
>     ... // some persistent attributes
>
> }
>
> public class FemaleDaoImpl extends RemoteServiceServlet implements
> FemaleDao {
>
>   /**
>     * Persists one employee obj
>    */
>     public Employee create(Employee entry) {
>                 PersistenceManager pm = PMF.get().getPersistenceManager();
>                 try {
>                         pm.makePersistent(entry);
>                 }
>                 finally {
>                         pm.close();
>                 }
>                 return entry;
>     }
>
> }
>
> //THE CALL
> public Request daoCreate(Employee entry) {
>                 AsyncCallback<Employee> callback = new 
> AsyncCallback<Employee>() {
>                         public void onFailure(Throwable caught) {
>
>                         }
>
>                         public void onSuccess(Employee result) {
>                                 Window.alert(result.getId()); //
> <-------------- RETURNS NULL???
>                                 ...
>                         }
>                 };
>
>                 return dao.create(entry, callback);
>         }
> ----
> Okay, when debugging this, the debugger tells me that , at the 'return
> entry' line, it has a generated id. So I know that on the server it
> gets an ID. but when it comes back the id is null again!
>
> I used detached=false, because of this serialization issue, but that's
> not a problem. I also tried copying the object I return attribute-by-
> attribute, but it also ended up  with an id being reset as soon as the
> onSucces() is called.
>
> Any ideas?
>
> Oh lastly, i got another object, which is not part of a inheritance,
> eg.
> public class Hobby {
>      String id;
>
> }
>
> Storing this in a similar function works fine!
>
> I've run into a wall here, is it a GWT bug? Or am I missing something?
-- 
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