对于我开发的一些应用程序(然后继续忘记),我一直在编写纯SQL,主要用于MySQL.虽然我在SQLAlchemy中使用了python中的ORM ,但我并没有坚持使用它们.通常是文件或复杂性(从我的观点来看)阻碍了我.
我看是这样的:使用ORM来实现可移植性,如果它只是使用一种类型的数据库则使用普通SQL.在开发需要数据库支持的应用程序时,我真的在寻找何时使用ORM或SQL的建议.
考虑到这一点,使用轻量级包装来处理数据库不一致与使用ORM相比会好得多.
我正在试图弄清楚如何使用GWTs FileUpload小部件上传一个文件.我正在使用GWT和谷歌AppEngine与Java,但我想将文件上传到我自己的Linux服务器.我已经有以下代码,但现在我无法弄清楚如何将我的文件提交到Google AppServer服务器并将其保存到另一台服务器:
public class FileUploader{
private ControlPanel cp;
private FormPanel form = new FormPanel();
private FileUpload fu = new FileUpload();
public FileUploader(ControlPanel cp) {
this.cp = cp;
this.cp.setPrimaryArea(getFileUploaderWidget());
}
@SuppressWarnings("deprecation")
public Widget getFileUploaderWidget() {
form.setEncoding(FormPanel.ENCODING_MULTIPART);
form.setMethod(FormPanel.METHOD_POST);
// form.setAction(/* WHAT SHOULD I PUT HERE */);
VerticalPanel holder = new VerticalPanel();
fu.setName("upload");
holder.add(fu);
holder.add(new Button("Submit", new ClickHandler() {
public void onClick(ClickEvent event) {
GWT.log("You selected: " + fu.getFilename(), null);
form.submit();
}
}));
form.addSubmitHandler(new FormPanel.SubmitHandler() {
public void onSubmit(SubmitEvent event) {
if …
Run Code Online (Sandbox Code Playgroud) 我刚开始玩GWT我很难让GWT + JAVA + JDO + Google AppEngine与DataStore合作.我试图遵循不同的教程,但没有运气.例如,我去了这些教程:TUT1 TUT2
我无法弄清楚如何以及为了使这项工作需要做些什么.请查看我的简单代码并告诉我我需要做什么,以便我可以将其持久保存到数据存储区:
1.地址实体
package com.example.rpccalls.client;
import java.io.Serializable;
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;
public class Address implements Serializable{
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private int addressID;
@Persistent private String address1;
@Persistent private String address2;
@Persistent private String city;
@Persistent private String state;
@Persistent private String zip;
public Address(){}
public Address(String a1, String a2, String city, String state, String zip){
this.address1 = a1;
this.address2 = a2;
this.city = city;
this.state = state;
this.zip …
Run Code Online (Sandbox Code Playgroud)