我正嘗試使用JPA創建簡單的數據庫連接。 它工作正常,但是當我嘗試拋出一個異常到客戶端,我得到的錯誤:GWT + JPA Persistence.Exception源代碼未找到
[ERROR] [browsereditor] - Line 210: No source code is available for type javax.persistence.EntityExistsException; did you forget to inherit a required module?
[ERROR] [browsereditor] - Line 212: No source code is available for type javax.persistence.EntityNotFoundException; did you forget to inherit a required module?
我得到了發展模式沒有錯誤,它編譯罰款,但是當應用模塊加載有我在哪裏得到錯誤。
我在服務器/作曲者和客戶端/演示類所需的進口
import javax.persistence.EntityExistsException;
import javax.persistence.EntityNotFoundException;
我還添加了以下jar添加到類路徑和構建路徑:
javax.persistence.jar
jpa-annotations-source.jar(http://code.google.com/p/google-web-toolkit/issues/detail?id=1830#c14)
我也嘗試添加到gwt.xml
<source path='client'/>
<source path='shared'/>
<source path='server'/>
如何告訴Eclipse在哪裏可以找到源代碼的任何想法?
感謝
下面是代碼:
//在服務器Presenter.class
創建一個從Composer.class的作曲家createComposer(上圖)public static Composer createComposer(String name)
throws EntityExistsException {
Composer comp = new Composer();
comp.setName(name);
comp.setId(1);
EntityManager entityManager = entityManager();
entityManager.getTransaction().begin();
entityManager.persist(comp);
entityManager.getTransaction().commit();
entityManager.close();
return comp;
}
///消防要求
req.fire(new Receiver<ComposerProxy>() {
public void onSuccess(ComposerProxy arg0) {
ComposerProxy comp;
comp = arg0;
}
public void onFailure(Throwable caught)
throws Throwable {
// Convenient way to find out which exception
// was thrown.
try {
throw caught;
} catch (EntityExistsException e) {
} catch (EntityNotFoundException e) {
}
}});
}});
[ERROR] [browsereditor] - Line 210: No source code is available for type javax.persistence.EntityExistsException; did you forget to inherit a required module?
[ERROR] [browsereditor] - Line 212: No source code is available for type javax.persistence.EntityNotFoundException; did you forget to inherit a required module?