Google App Engine (GAE) 中的 JDO Query

GAE 雲端程式

簡介

環境安裝

管理介面

資料庫

中文編碼

程式範例

Hello

Guestbook

WikiBox

TxtDBase

訊息

相關網站

參考文獻

最新修改

簡體版

English

GAE 中常使用 JDO 進行資料存取,您可以參考下列網址學習 JDO 語言。

http://www.jpox.org/docs/1_2/jdo/query.html

程式範例

<%
    PersistenceManager pm = PMF.get().getPersistenceManager();
    String query = "select from " + Greeting.class.getName();
    List<Greeting> greetings = (List<Greeting>) pm.newQuery(query).execute();
    out.println(query);
    if (greetings.isEmpty()) {
%>
<p>The guestbook has no messages.</p>
<%
    } else {
        for (Greeting g : greetings) {
            if (g.getAuthor() == null) {
%>
<p>An anonymous person wrote:</p>
<%
            } else {
%>
<p><b><%= g.getAuthor().getNickname() %></b> wrote:</p>
<%
            }
%>
<blockquote><%= g.getContent() %></blockquote>

參考文獻

  1. JDO Query API — http://www.jpox.org/docs/1_2/jdo/query.html
  2. javax.jdo , Interface PersistenceManager — http://db.apache.org/jdo/api20/apidocs/javax/jdo/PersistenceManager.html

#

Facebook

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License