Hi,
I must admit that my db knowledge is very lacking, thus I need some
help with making a simple query. I know I am just missing smth obvious
and easy.
Anyway, what I need is just a boolean method to check if enity
exists.
I am using Guice too, for binding all stuff.
I know that the query syntax is SELECT * FROM entity WHERE __key__ =
KEY('entity', 'key name')
My class for DB queries looks like that [yeah, from gae-wicket
template]:
public abstract class JdoQueries<T>
{
private final Class<T> clazz;
private final Provider<PersistenceManager> pmProvider;
protected JdoQueries(Class<T> clazz, Provider<PersistenceManager>
pmProvider)
{
this.clazz = clazz;
this.pmProvider = pmProvider;
}
protected Query newQuery()
{
return pmProvider.get().newQuery(clazz);
}
@SuppressWarnings("unchecked")
protected Collection<T> toCollection(Object queryResult)
{
return (Collection<T>) queryResult;
}
protected List<T> toList(Object queryResult)
{
return new ArrayList<T>(toCollection(queryResult));
}
}
I know I should create public interface for query I need, then create
a class extending JdoQueries and implementing my interface, but it's
just theory and I cannot write that final part :)
--
You received this message because you are subscribed to the Google Groups
"Google App Engine for Java" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-appengine-java?hl=en.