[appengine-java] many different Properties or Entity for name/value pairs

2011-11-03 Thread Mr. Schtief
Hi,

I'm using low level API for creating and managing Entitities. I have a Kind 
of Entity that can have unlimited name value pairs. Should i add them as 
properties or should i create a new kind of entity with the two properties 
name value and link them to the parent entity.

putting them as properties in the parent entity seems the best way for me, 
but then i have the problem of the datastore viewer which will display all 
possible properties for all entities, so the viewer page would be very wide.
The other problem is, that i cannot use multiple values for the same 
property name. right?

would do you suggest

schtieF

-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-appengine-java/-/yzU8RMCIiGwJ.
To post to this group, send email to google-appengine-java@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.



Re: [appengine-java] many different Properties or Entity for name/value pairs

2011-11-03 Thread Matthew Jaggard
I have an entity that has a class containing a MapString,String
called data - I then convert this to an entity using the method below

private Entity toEntity()
{
Entity entity = new Entity(KIND, this.getName());
if (data == null || data.isEmpty())
{
return entity;
}
for (Map.EntryString, SetString paramEntry : this.data.entrySet())
{
if (paramEntry.getKey() == null || paramEntry.getValue() == 
null ||
paramEntry.getValue().isEmpty())
{
continue;
}
entity.setUnindexedProperty(paramEntry.getKey(), 
paramEntry.getValue());
}
return entity;
}

and an opposite
private static MyClass fromEntity(Entity e)
method.

You could equally apply a collection to the map, for example the type
MapString,SetString (I've used Set because the order is not
guaranteed by App Engine). Then you could have more than one entry
with the same name - you'll just need to manage that in your classes
somehow.

Thanks,
Mat.

P.S. I know I should have used a DAO for this, but it's a quick and
dirty solution for now, I'm not sure I'll be using it long term - I
might use namespaces for the same task.

On 3 November 2011 11:23, Mr. Schtief lisc...@gmail.com wrote:
 Hi,
 I'm using low level API for creating and managing Entitities. I have a Kind
 of Entity that can have unlimited name value pairs. Should i add them as
 properties or should i create a new kind of entity with the two properties
 name value and link them to the parent entity.
 putting them as properties in the parent entity seems the best way for me,
 but then i have the problem of the datastore viewer which will display all
 possible properties for all entities, so the viewer page would be very wide.
 The other problem is, that i cannot use multiple values for the same
 property name. right?
 would do you suggest
 schtieF

 --
 You received this message because you are subscribed to the Google Groups
 Google App Engine for Java group.
 To view this discussion on the web visit
 https://groups.google.com/d/msg/google-appengine-java/-/yzU8RMCIiGwJ.
 To post to this group, send email to google-appengine-java@googlegroups.com.
 To unsubscribe from this group, send email to
 google-appengine-java+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/google-appengine-java?hl=en.


-- 
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 google-appengine-java@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.