将图像保存到 Google App Engine/Java 时出错

发布于 2024-08-10 17:42:50 字数 1431 浏览 3 评论 0原文

我正在尝试在 GAE/J 中创建以下 JDO 实体(我正在使用 Gilead )。

package test.domains;

import java.io.Serializable;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import net.sf.gilead.pojo.java5.LightEntity;

import com.google.appengine.api.datastore.Blob;
import com.google.appengine.api.datastore.Key;


@PersistenceCapable(identityType=IdentityType.APPLICATION, detachable="true")
public class Banner extends LightEntity implements Serializable
{
 private static final long serialVersionUID = 1058354709157710766L;

 // Fields
 @PrimaryKey
 @Persistent(valueStrategy=IdGeneratorStrategy.IDENTITY)
 private Key id;

 @Persistent
 private String name;

 @Persistent
 private String sizeX;

 @Persistent
 private String sizeY;

 @Persistent
 private String description;

 @Persistent
 private Blob img;

 // Getters and Setters
}

并遇到以下问题:

[错误]第 40 行:没有源代码 可用于类型 com.google.appengine.api.datastore.Blob; 你是否忘记继承一个必需的 模块?

什么会导致这个问题?代码在没有 Blob 对象的情况下编译良好。顺便说一句,我尝试遵循 这个示例。

I'm trying to make following JDO entity in GAE/J (I'm using Gilead).

package test.domains;

import java.io.Serializable;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import net.sf.gilead.pojo.java5.LightEntity;

import com.google.appengine.api.datastore.Blob;
import com.google.appengine.api.datastore.Key;


@PersistenceCapable(identityType=IdentityType.APPLICATION, detachable="true")
public class Banner extends LightEntity implements Serializable
{
 private static final long serialVersionUID = 1058354709157710766L;

 // Fields
 @PrimaryKey
 @Persistent(valueStrategy=IdGeneratorStrategy.IDENTITY)
 private Key id;

 @Persistent
 private String name;

 @Persistent
 private String sizeX;

 @Persistent
 private String sizeY;

 @Persistent
 private String description;

 @Persistent
 private Blob img;

 // Getters and Setters
}

And encountering following problem:

[ERROR] Line 40: No source code is
available for type
com.google.appengine.api.datastore.Blob;
did you forget to inherit a required
module?

What can cause this problem? The code compiles fine without Blob object. By the way I tried to follow this example.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

遮云壑 2024-08-17 17:42:50

据我所知,吉利德不支持 com.google.appengine.api.datastore.Blob

adapter4appengine-1.0M2.jar 包含“com.google.appengine.api.datastore.Key”的模拟器类

As far as i can tell, it is Gilead that does not have support for com.google.appengine.api.datastore.Blob.

The adapter4appengine-1.0M2.jar on contains an emulator class for 'com.google.appengine.api.datastore.Key'

放肆 2024-08-17 17:42:50

您是否将该文件保存在客户端?这是我认为 GWT 找不到 Blob .class 文件的唯一原因。

试一试。

海梅·E

Are you keeping that file in the client side? That's the only reason I can think GWT is not finding the Blob .class file.

Give it a shot.

Jaime E

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文