GAE (1.7.4):
- 取得上傳日期
String applicationVersion = SystemProperty.applicationVersion.get();
Date uploadDate = new Date(Long.parseLong(applicationVersion.substring(applicationVersion.lastIndexOf(".")+1))/ (2 << 27) * 1000);
Ref: SystemProperty JPA 2
限制:- Simple Join
- Entity Group Transaction
An entity’s parent, parent’s parent, and so on recursively, are its ancestors; its children, children’s children, and so on, are its descendants. An entity and its descendants are said to belong to the same **entity group**_._
一般我們常常在一個transaction內大量修改同一類型物件,例如修改多個User的資料,這就算 Cross Group Transaction操作,最多不能超過5個entity group。
- Google App Engine JPA test case
- simple join works on unowned one-to-many relationship.
- limitation: Problem with query : Joins can only be sorted by the join column in ascending order (in this case
‘attendeeList’) - 開發GAE會遇到的問題
Maven
若使用JPA,datanucleus plugin 的設定官方文件未提及,不方便,很容易跟project 依賴的版本不合。我參考http://www.loop81.com/2013/02/gae-google-app-engine-jpa2-maven-and.html
https://code.google.com/p/datanucleus-appengine/source/browse/trunk/pom.xml
https://code.google.com/p/datanucleus-appengine/wiki/Compatibility
使用 GAE Maven plugin時,在eclipse debug mode下執行時
http://stackoverflow.com/questions/13924990/how-do-i-make-eclipse-and-mvn-appenginedevserver-talk-to-each-other
Jersey (1.18)
- NoClassDefFoundError: misc.sun.Unsafe on Google App Engine Jerset 2.x 因有已知的bug無法run 在GAE 上,
- java.lang.IncompatibleClassChangeError: Implementing class
因為Jersey 1.18依賴 asm 3.1, 但GAE倚賴asm 4所造成。
有兩個解決辦法:
- 改用asm 3
- 寫一個class 繼承javax.ws.rs.core.Application 去指定annotated class
留言