[appengine-java] Re: Getting error when passing the object to client side please help me..

2011-03-03 Thread Didier Durand
Hi,

As said in the message StreamingQueryResult (the result of your query)
doesn't itself implement the the Serializable interface that you have
for your own classes.

What you should do: defining your own class based on any Collection
your prefer (List, Vector, Map, etc.), make it implement Serializable
as you did for your other classes.

Then when you get a QueryResult, you loop into it to extract your own
object, put them in an instance of your collection class above and
ship it to client. That should work.

Anyway, it's better not to send instances of typical server side
objects like StreamingQueryResult to the client side.

regards

didier

On Mar 3, 10:36 am, andy  wrote:
> My code here:
> Employee Class:
> @PersistenceCapable(identityType =
> IdentityType.APPLICATION,detachable="true")
> public class Employee implements Serializable {
>     private static final long serialVersionUID = 1L;
>
>     @PrimaryKey
>     @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
>     @Extension(vendorName="datanucleus", key="gae.encoded-pk",
>     value="true")
>     private String id;
>     @Persistent
>     private String ename;
>
>     @Persistent
>     private String designation;
>     @Persistent(mappedBy="parentEmployee",defaultFetchGroup="true")
>     private List leaves;
>
>     @Persistent
>     @Embedded
>     private EmployeeManager employeeManager;
>
> }
>
> Leave Class:
> @PersistenceCapable(identityType =
> IdentityType.APPLICATION,detachable="true")
> public class Leave implements Serializable{
>
>     private static final long serialVersionUID = 1L;
>
>     @PrimaryKey
>     @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
>     @Extension(vendorName="datanucleus", key="gae.encoded-pk",
>     value="true")
>     private String leaveid;
>
>     @Persistent
>     private String reason;
>
>     @Persistent
>     private String status;
>
> //    @OneToMany(fetch=FetchType.EAGER)
>     public Employee parentEmployee;
>
> }
>
> EmployeeManager:
>
> @PersistenceCapable
> @EmbeddedOnly
> public class EmployeeManager implements Serializable {
>     private static final long serialVersionUID = 1L;
>
>     @Persistent
>     public String managerId;
>
> }
>
> when i covert the result into String and then send to client then it is
> accepting but when i am sending object it giving me error like:
>  Type 'org.datanucleus.store.appengine.query.StreamingQueryResult' was not
> included in the set of types which can be serialized by this
> SerializationPolicy or its Class object could not be loaded. For security
> purposes, this type will not be serialized.: instance =
> [parentemp.client.Employee@1988799, parentemp.client.Employee@ee738e,
> parentemp.client.Employee@e48ee2]
>
> What should i do...???

-- 
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 google-appengine-java@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.



[appengine-java] Re: Getting error when passing the object to client side please help me..

2011-03-05 Thread andy
thanks , i will try it now... one more thing i wants to ask that how get the 
child record(only child properties or including some parent properties) 
based on the parent properties? because i have used the one to many relation 
and there is on parent property in child. 
One way to do this- using the parent object but unnecessarily i am 
retrieving the all parent records.So what can do?

-- 
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 google-appengine-java@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.



[appengine-java] Re: Getting error when passing the object to client side please help me..

2011-03-05 Thread Didier Durand
Hi,

If you have the managerId in your employeeManager, you just do a query
with a filter() on managerId and you'll get all employee having this
manager.

regards

didier

On Mar 6, 6:54 am, andy  wrote:
> thanks , i will try it now... one more thing i wants to ask that how get the
> child record(only child properties or including some parent properties)
> based on the parent properties? because i have used the one to many relation
> and there is on parent property in child.
> One way to do this- using the parent object but unnecessarily i am
> retrieving the all parent records.So what can do?

-- 
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 google-appengine-java@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.



[appengine-java] Re: Getting error when passing the object to client side please help me..

2011-03-05 Thread andy
hey, thanks.
 i did that with DTO class. means every time if i want send the result i 
should have to use DTO class objects??

-- 
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 google-appengine-java@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.