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

2011-12-25 Thread -sowdri-
Can you post the class firing the below request?

 requests.find(proxyId).with(resource, 
action, subjects).fire(callback); 

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/Y2Z0vxZJ6MwJ.
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.



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

2011-12-23 Thread tzhotmail
Hi ,

The AbstractRequestFactory in the client throws this exception, method

public P extends EntityProxy RequestP find(EntityProxyIdP
proxyId) {
if (((SimpleEntityProxyIdP) 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 Setcom.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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



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

2011-12-20 Thread tzhotmail
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.

Does request factory support inheritance ?


@MappedSuperclass
public class Base implements java.io.Serializable{
   /**
 *
 */
private static final long serialVersionUID = -3767474991121795712L;
private Integer version = 0;
protected Long id;
/**
 * Auto-increment version # whenever persisted
 */
@PrePersist
void onPersist()
{
this.version++;
}


@Transient
public Integer getVersion()
{
return version;
}

public void setVersion(Integer version)
{
this.version = version;
}

@Id
@GeneratedValue(strategy=GenerationType.AUTO)
@Column(name = id, unique = true, nullable = false)
public Long getId() {
return this.id;
}

public void setId(long id) {
this.id = id;
}

}

And Other classes as follows

@Entity
@Table(name = Action)
public class Action extends Base {

/**
 *
 */
private static final long serialVersionUID = -1034167141757868139L;

private String name;
private String creationUser;
private Date creationDate;
private String modUser;
private Date modDate;
private SetRule ruleses = new HashSetRule(0);

public Action() {
}

public Action(long id, String name, String creationUser, Date
creationDate,
String modUser, Date modDate) {
this.id = id;
this.name = name;
this.creationUser = creationUser;
this.creationDate = creationDate;
this.modUser = modUser;
this.modDate = modDate;
}

public Action(long id, String name, String creationUser, Date
creationDate,
String modUser, Date modDate, SetRule ruleses) {
this.id = id;
this.name = name;
this.creationUser = creationUser;
this.creationDate = creationDate;
this.modUser = modUser;
this.modDate = modDate;
this.ruleses = ruleses;
}



@Column(name = name, nullable = false, length = 2000)
public String getName() {
return this.name;
}

public void setName(String name) {
this.name = name;
}

@Column(name = creationUser, nullable = false, length = 10)
public String getCreationUser() {
return this.creationUser;
}

public void setCreationUser(String creationUser) {
this.creationUser = creationUser;
}

@Temporal(TemporalType.TIMESTAMP)
@Column(name = creationDate, nullable = false, length = 23)
public Date getCreationDate() {
return this.creationDate;
}

public void setCreationDate(Date creationDate) {
this.creationDate = creationDate;
}

@Column(name = modUser, nullable = false, length = 10)
public String getModUser() {
return this.modUser;
}

public void setModUser(String modUser) {
this.modUser = modUser;

-- 
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.



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

2011-12-20 Thread Thomas Broyer


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 view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/D2rYkMDhZHYJ.
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.