Hi Philip,

I would think using plain Java objects to represent a table and its
columns would be a better approach than using the low-level API
directly.  For example, you probably want to keep some fixed info
about a table like its name, creation date, sort fields etc - and then
a collection of Column instances with fixed fields for data type name,
restrictions etc.

I believe that Twig is the only library that can store objects with
entire collections embedded as components.  So the Columns could
actually be stored in the same entity as the Table.  This means that
querying or reading Tables is _much_ faster.  If the tables are read
more than written this would be ideal.

Docs are a bit light but basically you just define an embedded
collection like this:

class Table
{
  @Key String name;
  @Component Collection<Column> columns;
}

and thats it!  The columns are then stored as a multi-valued property
so you can even query properties them like "show all tables with a
column named 'age'".

more info and the source here: http://code.google.com/p/twig-persist/

JD

On Jan 15, 10:35 am, Joel Weight <digitalj...@gmail.com> wrote:
> Wow, biggest code review ever for me.  As a disclaimer, this is my first
> app-engine app, and I'm learning as I go along with the rest of you, so I'm
> sure there are plenty of shortcomings in this approach that I'll have to
> address as I get further along in my development.  Also, since that link
> points directly to my subversion repository, it's probably going to be
> changing over time.  That said, I thought the example at the bottom of the
> package-summary page that was linked in the OP was quite a good start.
>
> Joel
>
> On Thu, Jan 14, 2010 at 7:36 PM, Rusty Wright <rwright.li...@gmail.com>wrote:
>
>
>
> > Joel Weight wrote a data store service that I thought was easy to
> > understand.  Reading his code made me realize that what's in the data store
> > is basically the fields of the object, without the object itself; therefore
> > to "re-hydrate" an object from the data store, you first instantiate/new the
> > object, then fetch its row from the data store, then for each property you
> > got from the data store, call the object's setter with it.
>
> >http://kenai.com/projects/seedsofchance/sources/subversion/content/so...
>
> > philip wrote:
>
> >> Hi All,
>
> >> I want to use the low level datastore, I looked at the documentation
> >> and it looks ... complex.
>
> >>http://code.google.com/intl/zh-HK/appengine/docs/java/javadoc/com/goo...
>
> >> Basically, I have a client program which needs to create tables and
> >> their entities dynamically, so the columns would change over time.
> >> This does not fit well with JDO as it works for fixed column entitys
> >> that are annotated. So I thought to use the low level API but it looks
> >> difficult. Is there any example code around?
>
> >> Alternatively, can someone suggest another way?
>
> >> Phil
>
> > --
> > 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-j...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > google-appengine-java+unsubscr...@googlegroups.com<google-appengine-java%2B 
> > 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-j...@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.


Reply via email to