Это мой код для использования класса сущности с использованием локатора в GWT
@SuppressWarnings("unchecked")
public List<User> findAllUsers() {
EntityManager em = HibernateUtil.getManager();
try {
// userList = em.createQuery("from User").getResultList();
// Query query = em.createNativeQuery("select * from User");
// System.out.println("query is created!");
// List<User> userList = query.getResultList();
List<User> userList = new ArrayList<User>(em.createNativeQuery("select * from User").getResultList());
// force it to materialize
System.out.println(userList.size());
return userList;
}catch(Exception e){
e.printStackTrace();
}
finally {
// em.close();
}
System.out.println("server is null");
return null;
}
Код моей сущности здесь:
@Entity
@Table(name = "user")
public class User implements Serializable{
/**
*
*/
private static final long serialVersionUID = 1L;
@Id
@Column(name = "id")
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Version
@Column(name = "version")
private Integer version;
private String userName;
private String password;
private String copyPassword;
private String qqNum;
private String mailAddress;
private String selfment;
private User superVisor;
public Long getId() {
return this.id;
}
public static long getSerialversionuid() {
return serialVersionUID;
}
public void setId(Long id) {
this.id = id;
}
public void setVersion(Integer version) {
this.version = version;
}
public Integer getVersion() {
return this.version;
}
public String getUserName() {
return this.userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getPassword() {
return this.password;
}
public void setPassword(String password) {
this.password = password;
}
public String getCopyPassword() {
return this.copyPassword;
}
public void setCopyPassword(String copyPassword) {
this.copyPassword = copyPassword;
}
public String getQqNum() {
return this.qqNum;
}
public void setQqNum(String qqNum) {
this.qqNum = qqNum;
}
public String getMailAddress() {
return this.mailAddress;
}
public void setMailAddress(String mailAddress) {
this.mailAddress = mailAddress;
}
public String getSelfment() {
return this.selfment;
}
public void setSelfment(String selfment) {
this.selfment = selfment;
}
public void setSuperVisor(User superVisor) {
this.superVisor = superVisor;
}
public User getSuperVisor() {
return this.superVisor;
}
}
ничего в консоли, и эта информация очень скоро появилась в режиме разработки:
Caused by: java.lang.RuntimeException: Server Error: NONE
at com.google.web.bindery.requestfactory.shared.Receiver.onFailure(Receiver.java:44)
at com.google.web.bindery.requestfactory.shared.impl.AbstractRequest.onFail(AbstractRequest.java:118)
at com.google.web.bindery.requestfactory.shared.impl.AbstractRequestContext$StandardPayloadDialect.processPayload(AbstractRequestContext.java:359)
at com.google.web.bindery.requestfactory.shared.impl.AbstractRequestContext$5.onTransportSuccess(AbstractRequestContext.java:1108)
at com.google.web.bindery.requestfactory.gwt.client.DefaultRequestTransport$1.onResponseReceived(DefaultRequestTransport.java:136)
at com.google.gwt.http.client.Request.fireOnResponseReceived(Request.java:287)
at com.google.gwt.http.client.RequestBuilder$1.onReadyStateChange(RequestBuilder.java:395)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:337)
at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:218)
at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:269)
at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:213)
at sun.reflect.GeneratedMethodAccessor25.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:292)
at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:546)
at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:363)
at java.lang.Thread.run(Unknown Source)
Кто-нибудь может подсказать, почему возникает эта ошибка?