Friday, December 23, 2011

Re: Caused by: java.lang.IllegalArgumentException: Cannot fetch unpersisted entity

Hi ,

The AbstractRequestFactory in the client throws this exception, method

public <P extends EntityProxy> Request<P> find(EntityProxyId<P>
proxyId) {
if (((SimpleEntityProxyId<P>) proxyId).isEphemeral()) {
throw new IllegalArgumentException("Cannot fetch unpersisted
entity");
}

but the weird issue is that the data is persisted to the database.
RuleProxy is a new entity with no persistent id, but
ActionProxy,ResourceProxy and Subject all have a persistent id.

The entities/proxy are as follows
public interface RuleProxy extends EntityProxy {
.......

abstract ResourceProxy getResource();

abstract void setResource(ResourceProxy resource);

abstract ActionProxy getAction();

abstract void setAction(ActionProxy action);

abstract Set<com.citi.gpf.cues.client.proxy.SubjectProxy>
getSubjects();

the call to persist:
request.persist(RuleProxy).fire() ; I am doing something wrong
here ???

then I call a finder method as follows
requests.find(proxyId).with("resource", "action",
"subjects").fire(callback);
I am just wondering whether I am calling the finder method before the
persist request has been returned.


thanks,

On Dec 20, 9:48 am, Thomas Broyer <t.bro...@gmail.com> wrote:
> On Monday, December 19, 2011 10:59:16 PM UTC+1, tzhotmail wrote:
>
> > Hi,
>
> > I have a base Entity class  with subclasses as shown below.  I can
> > view and update my entities but I get the exception
> > java.lang.IllegalArgumentException: Cannot fetch unpersisted entity
> > whenever I try to save /persist a new entity.
>
> What does throw this exception? (I suppose Hibernate, Datanucleus or
> whichever JPA implementation you're using)
> And when? (which method, and what's the stack-trace?)
>
> > Does request factory support inheritance ?
>
> Yes.
>
>
>
>
>
>
>
>

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment