开发者

Cant delete photo in JDO

I'开发者_运维知识库m have a hard time doing this. I have done a db with JDO for google app engine that allows for a registered user to upload a photo. But now i'm trying to delete that same photo and i just cant do it.

This is my class in the db.

public class Autenticacao 
{   
@PrimaryKey
@Persistent
String utilizador;

@Persistent
String password;

@Persistent
String cookie;

@Persistent
String loginIP;

@Persistent
public Blob photo;

and i'm trying to delete the blob object like this.

public static String novo(Autenticacao utilAutenticado)
{
    PersistenceManager pm = PMF.get().getPersistenceManager();

    try {

        Object e = pm.getObjectById(utilAutenticado.photo);
        pm.deletePersistent(e);

    } finally {
        pm.close();

    }
    return null;

}

I've tried other ways but it doesnt seem its working. The last error i got was

"The class "The class "com.google.appengine.api.datastore.Blob" is not persistable. This means that it either hasnt been enhanced, or that the enhanced version of the file is not in the CLASSPATH (or is hidden by an unenhanced version), or the Meta-Data/annotations for the class are not found." is not persistable. This means that it either hasnt been enhanced, or that the enhanced version of the file is not in the CLASSPATH (or is hidden by an unenhanced version), or the Meta-Data for the class is not found."

Can't really understand why this is happening. Has someone any thought about this?


No idea what you seem to be trying there. Would make more sense to just do

utilAutenticado.setPhoto(null);

when the "utilAutenticado" is a managed object (i.e just obtained from the PersistenceManager). Any decent JDO book would show that

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜