mercredi 23 septembre 2015

OrmLite execute sql statement

I have a database in OrmLite. Here one of the tables — Field:

@DatabaseTable
public class Field {

    @DatabaseField(generatedId = true)
    private long id;

    @DatabaseField
    private String type;

    @ForeignCollectionField(eager = true)
    private Collection<FieldListValue> listValue;
    ...
}

I want to delete some values from the table like in this query:

DELETE * FROM Field WHERE type = 'list' AND (SELECT COUNT(listValue) FROM Field) = 0;

But, if I make it in this way:

fieldDao.executeRawNoArgs(statement);

I get the SQLException: Problems executing...

How can I execute this query with DeleteBuilder ?

The problem with this piece of code ...(SELECT COUNT(listValue) FROM Field) = 0

Aucun commentaire:

Enregistrer un commentaire