Git Product home page Git Product logo

objectify's Introduction

Objectify

Objectify is a Java data access API specifically designed for the Google Cloud Datastore (aka the Google App Engine Datastore aka Firestore in Cloud Datastore mode). It occupies a "middle ground"; easier to use and more transparent than JDO or JPA, but significantly more convenient than the low-level API libraries that Google provides. Objectify is designed to make novices immediately productive yet also expose the full power of the Datastore.

Important note about versions: Objectify v5 and prior use the Google App Engine API for Java and therefore can only be used within Google App Engine Standard. Objectify v6+ uses the Cloud Datastore API and can be used from anywhere - GAE Standard, GAE Flex, GCE, or outside Google Cloud entirely. See the FAQ for more information.

Features

  • Objectify lets you persist, retrieve, delete, and query your own typed objects.
@Entity
class Car {
    @Id String vin; // Can be Long, long, or String
    String color;
}
  
ofy().save().entity(new Car("123123", "red")).now();
Car c = ofy().load().type(Car.class).id("123123").now();
ofy().delete().entity(c);
  • Objectify surfaces all native datastore features, including batch operations, queries, transactions, asynchronous operations, and partial indexes.
  • Objectify provides type-safe key and query classes using Java generics.
  • Objectify provides a human-friendly query interface.
  • Objectify can automatically cache your data in memcache for improved read performance.
  • Objectify can store polymorphic entities and perform true polymorphic queries.
  • Objectify provides a simple, easy-to-understand transaction model.
  • Objectify provides built-in facilities to help migrate schema changes forward.
  • Objectify provides thorough documentation of concepts as well as use cases.
  • Objectify has an extensive test suite to prevent regressions.

Documentation

Full documentation is available in the Objectify Wiki.

Downloads

Objectify is released to the Maven Central Repository and can be downloaded directly from there.

Help

Help is provided in the Objectify App Engine User Group

objectify's People

Contributors

arielcabib avatar aymandf avatar dependabot[bot] avatar eddavisson avatar eincs avatar elharo avatar fkorotkov avatar freddyboucher avatar frew avatar gavin-haynes-grow avatar jdban avatar lookfirst avatar macil avatar mrxz avatar natthu avatar stickfigure avatar ttozser avatar wsh avatar zhaoyan1117 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

objectify's Issues

Add support for value converters

Original issue 28 created by objectify on 2010-03-28T18:52:31.000Z:

It would be nice if there was possibility to transparently convert types
not supported by Datastore to it's core types.
For example, we have problem if we use BigDecimal. In datastore we can
persist a number only as double or long, what can cause loss of precision.
Converting BigDecimal to string will do the trick, but problem is that we
have to write conversion logic in our model classes.

My vision for resolution of this problem:

Objectify defines a simple interface for value converter:

interface ValueConverter {
Object toDatastoreValue(Object v);
Object fromDatastoreValue(Object v);
}

We write simple converter for BigDecimal (we can write more sophisticated
one which will prevent order)

class BigDecimalConverter {
Object toDatastoreValue(Object v) {
return ((BigDecimal)v).toPlainString();
}
Object fromDatastoreValue(Object v) {
return new BigDecimal((String)v);
}
}

We register our converter:

factory.register(java.math.BigDecimal.class, new BigDecimalConverter());

Now we simply use BigDecimal fields in our classes and Objectify does the
rest.

concepts documentation

Original issue 17 created by objectify on 2010-02-07T06:45:45.000Z:

In the Keys section you say "but for now what you need to know is that this
parent (which is often simply null)". You could expand that parenthetical
remark and say "(which is often simply null, making it an unparented, root
entity)".

Unhelpful, late, error when registering an entity with no no-arg constructor

Original issue 4 created by objectify on 2010-01-25T05:02:33.000Z:

What steps will reproduce the problem?

  1. Register a class with no public no-arg constructor (this works)
  2. Do a get() or query() using that entity
  3. Get an exception like:
    [java] java.lang.RuntimeException: java.lang.IllegalAccessException:
    Class com.googlecode.objectify.EntityMetadata can not access a member of
    class com.foo.SomeEntity with modifiers "protected"
    [java] at
    com.googlecode.objectify.EntityMetadata.toObject(EntityMetadata.java:288)
    [java] at
    com.googlecode.objectify.OPreparedQueryImpl$ToObjectIterator.next(OPreparedQueryImpl.java:166)
    [java] at
    com.googlecode.objectify.OPreparedQueryImpl.asList(OPreparedQueryImpl.java:79)
    [java] at com.foo.model.DAO.getHistory(DAO.java:43)

What is the expected output? What do you see instead?

An exception during register(), not after register().

What version of the product are you using? On what operating system?

1.0.1

Please provide any additional information below.

I've attached a patch (against trunk@187) that throws an exception during
register() (and a test, too!)

java.lang.IllegalStateException: Unable to construct an instance of java.lang.Integer when using HashMap

I have this issue when I try to retrieve the HashMap, it seems to be persisting find in the datastore.
First I had it declared like:

@Serialize @Unindex private HashMap score = new HashMap(2); (The map is String, Integer. Github doesn't show them for some odd reason.)

Which as giving me an assertion error. Then I removed the @unindex and changed it to @embed, now I get this error much longer error trace:

Apr 24, 2013 6:56:22 PM com.google.apphosting.utils.jetty.JettyLogger warn
WARNING: Error for /mobaraty/databaseService
java.lang.ExceptionInInitializerError
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:188)
at com.google.appengine.tools.development.agent.runtime.RuntimeHelper.checkRestricted(RuntimeHelper.java:70)
at com.google.appengine.tools.development.agent.runtime.Runtime.checkRestricted(Runtime.java:64)
at com.mobaraty.server.rpc.DatabaseServiceImpl.loadContent(DatabaseServiceImpl.java:56)
at com.mobaraty.server.rpc.DatabaseServiceImpl.(DatabaseServiceImpl.java:32)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
at java.lang.Class.newInstance0(Class.java:374)
at java.lang.Class.newInstance(Class.java:327)
at org.mortbay.jetty.servlet.Holder.newInstance(Holder.java:153)
at org.mortbay.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:428)
at org.mortbay.jetty.servlet.ServletHolder.getServlet(ServletHolder.java:339)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
at com.googlecode.objectify.cache.AsyncCacheFilter.doFilter(AsyncCacheFilter.java:59)
at com.googlecode.objectify.ObjectifyFilter.doFilter(ObjectifyFilter.java:49)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at com.google.appengine.api.socket.dev.DevSocketFilter.doFilter(DevSocketFilter.java:74)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at com.google.appengine.tools.development.ResponseRewriterFilter.doFilter(ResponseRewriterFilter.java:123)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at com.google.appengine.tools.development.HeaderVerificationFilter.doFilter(HeaderVerificationFilter.java:34)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:63)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:43)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFileFilter.java:125)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at com.google.appengine.tools.development.DevAppServerServersFilter.doDirectRequest(DevAppServerServersFilter.java:369)
at com.google.appengine.tools.development.DevAppServerServersFilter.doDirectServerRequest(DevAppServerServersFilter.java:352)
at com.google.appengine.tools.development.DevAppServerServersFilter.doFilter(DevAppServerServersFilter.java:115)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
at com.google.appengine.tools.development.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:94)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at com.google.appengine.tools.development.JettyContainerService$ApiProxyHandler.handle(JettyContainerService.java:421)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:326)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:938)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:755)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
Caused by: java.lang.IllegalStateException: Unable to construct an instance of java.lang.Integer; perhaps it has no suitable constructor?
at com.googlecode.objectify.impl.translate.ClassTranslator.(ClassTranslator.java:46)
at com.googlecode.objectify.impl.translate.EmbedClassTranslatorFactory.create(EmbedClassTranslatorFactory.java:43)
at com.googlecode.objectify.impl.translate.TranslatorRegistry.create(TranslatorRegistry.java:90)
at com.googlecode.objectify.impl.translate.MapTranslatorFactory.create(MapTranslatorFactory.java:59)
at com.googlecode.objectify.impl.translate.TranslatorRegistry.create(TranslatorRegistry.java:90)
at com.googlecode.objectify.impl.translate.ClassTranslator.(ClassTranslator.java:52)
at com.googlecode.objectify.impl.translate.EntityClassTranslator.(EntityClassTranslator.java:46)
at com.googlecode.objectify.impl.Transmog.(Transmog.java:49)
at com.googlecode.objectify.impl.ConcreteEntityMetadata.(ConcreteEntityMetadata.java:58)
at com.googlecode.objectify.impl.Registrar.register(Registrar.java:74)
at com.googlecode.objectify.ObjectifyFactory.register(ObjectifyFactory.java:180)
at com.mobaraty.server.OfyService.(OfyService.java:17)
... 53 more
Caused by: java.lang.IllegalStateException: java.lang.Integer must have a no-arg constructor
at com.googlecode.objectify.impl.TypeUtils.getNoArgConstructor(TypeUtils.java:52)
at com.googlecode.objectify.ObjectifyFactory.construct(ObjectifyFactory.java:79)
at com.googlecode.objectify.impl.translate.ClassTranslator.(ClassTranslator.java:44)
... 64 more
Caused by: java.lang.NoSuchMethodException: java.lang.Integer.()
at java.lang.Class.getConstructor0(Class.java:2730)
at java.lang.Class.getDeclaredConstructor(Class.java:2004)
at com.googlecode.objectify.impl.TypeUtils.getNoArgConstructor(TypeUtils.java:43)
... 66 more

Apr 24, 2013 6:56:22 PM com.google.apphosting.utils.jetty.JettyLogger warn
WARNING: Nested in java.lang.ExceptionInInitializerError:
java.lang.IllegalStateException: Unable to construct an instance of java.lang.Integer; perhaps it has no suitable constructor?
at com.googlecode.objectify.impl.translate.ClassTranslator.(ClassTranslator.java:46)
at com.googlecode.objectify.impl.translate.EmbedClassTranslatorFactory.create(EmbedClassTranslatorFactory.java:43)
at com.googlecode.objectify.impl.translate.TranslatorRegistry.create(TranslatorRegistry.java:90)
at com.googlecode.objectify.impl.translate.MapTranslatorFactory.create(MapTranslatorFactory.java:59)
at com.googlecode.objectify.impl.translate.TranslatorRegistry.create(TranslatorRegistry.java:90)
at com.googlecode.objectify.impl.translate.ClassTranslator.(ClassTranslator.java:52)
at com.googlecode.objectify.impl.translate.EntityClassTranslator.(EntityClassTranslator.java:46)
at com.googlecode.objectify.impl.Transmog.(Transmog.java:49)
at com.googlecode.objectify.impl.ConcreteEntityMetadata.(ConcreteEntityMetadata.java:58)
at com.googlecode.objectify.impl.Registrar.register(Registrar.java:74)
at com.googlecode.objectify.ObjectifyFactory.register(ObjectifyFactory.java:180)
at com.mobaraty.server.OfyService.(OfyService.java:17)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:188)
at com.google.appengine.tools.development.agent.runtime.RuntimeHelper.checkRestricted(RuntimeHelper.java:70)
at com.google.appengine.tools.development.agent.runtime.Runtime.checkRestricted(Runtime.java:64)
at com.mobaraty.server.rpc.DatabaseServiceImpl.loadContent(DatabaseServiceImpl.java:56)
at com.mobaraty.server.rpc.DatabaseServiceImpl.(DatabaseServiceImpl.java:32)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
at java.lang.Class.newInstance0(Class.java:374)
at java.lang.Class.newInstance(Class.java:327)
at org.mortbay.jetty.servlet.Holder.newInstance(Holder.java:153)
at org.mortbay.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:428)
at org.mortbay.jetty.servlet.ServletHolder.getServlet(ServletHolder.java:339)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
at com.googlecode.objectify.cache.AsyncCacheFilter.doFilter(AsyncCacheFilter.java:59)
at com.googlecode.objectify.ObjectifyFilter.doFilter(ObjectifyFilter.java:49)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at com.google.appengine.api.socket.dev.DevSocketFilter.doFilter(DevSocketFilter.java:74)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at com.google.appengine.tools.development.ResponseRewriterFilter.doFilter(ResponseRewriterFilter.java:123)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at com.google.appengine.tools.development.HeaderVerificationFilter.doFilter(HeaderVerificationFilter.java:34)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:63)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:43)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFileFilter.java:125)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at com.google.appengine.tools.development.DevAppServerServersFilter.doDirectRequest(DevAppServerServersFilter.java:369)
at com.google.appengine.tools.development.DevAppServerServersFilter.doDirectServerRequest(DevAppServerServersFilter.java:352)
at com.google.appengine.tools.development.DevAppServerServersFilter.doFilter(DevAppServerServersFilter.java:115)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
at com.google.appengine.tools.development.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:94)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at com.google.appengine.tools.development.JettyContainerService$ApiProxyHandler.handle(JettyContainerService.java:421)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:326)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:938)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:755)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
Caused by: java.lang.IllegalStateException: java.lang.Integer must have a no-arg constructor
at com.googlecode.objectify.impl.TypeUtils.getNoArgConstructor(TypeUtils.java:52)
at com.googlecode.objectify.ObjectifyFactory.construct(ObjectifyFactory.java:79)
at com.googlecode.objectify.impl.translate.ClassTranslator.(ClassTranslator.java:44)
... 64 more
Caused by: java.lang.NoSuchMethodException: java.lang.Integer.()
at java.lang.Class.getConstructor0(Class.java:2730)
at java.lang.Class.getDeclaredConstructor(Class.java:2004)
at com.googlecode.objectify.impl.TypeUtils.getNoArgConstructor(TypeUtils.java:43)
... 66 more

Create sample project

Original issue 27 created by objectify on 2010-03-24T07:04:32.000Z:

We need some sort of simple "getting started" project.

Loading object with byte[] causes error.

Original issue 31 created by objectify on 2010-04-11T03:07:01.000Z:

I'm using the Objectify 2.1.

In my User class, I store the hashed password as a byte[]. When I put it in
the datastore, it is correctly stored as a blob.

When I try to load the User object back out I get this error:

java.lang.IllegalStateException: Cannot load non-collection value '<Blob: 40
bytes>' into private byte[]

Is this a problem with how I have things set up, or a problem with Objectify?
Anyone know how I could fix this?

Concepts documentation

Original issue 10 created by objectify on 2010-01-30T05:52:44.000Z:

"If another process modifies the your data before you commit, your
datastore operations will fail with a ConcurrentModificationException"

Spurious "the".

Filter doesn't work with Kind queries

There is a problem with filtering .kind queries

final com.googlecode.objectify.Key<?> agencyKey = ofy().load()
        .kind("MyEntity")
        .filter("my_field", ns)

I get exception, because class is null for Kind queries in LoadTypeImpl

java.lang.NullPointerException
    at com.googlecode.objectify.impl.QueryImpl.<init>(QueryImpl.java:69)
    at com.googlecode.objectify.impl.LoadTypeImpl.createQuery(LoadTypeImpl.java:52)
    at com.googlecode.objectify.impl.LoadTypeImpl.filter(LoadTypeImpl.java:60)

the problem comes to this line (QueryImpl.java:69):

    Subclass sub = clazz.getAnnotation(Subclass.class);

which should be in if block, as clazz is null for kind queries

Objectify does not provide "managed" relationships in the way that JDO or JPA does

Original issue 26 created by objectify on 2010-03-01T08:57:15.000Z:

As you said in the wiki...
I like managed relationships.. so I have added support for them.

Lets say this:

class Person {
@id String name;
Person friend;
}

now works exactly the same as this one:

class Person {
@id String name;
Key<Person> friend;
}

The only difference is that in the first one the "friend" get fetched automatically when you get a
Person, and when you put a Person with a friend != null, the friend has to be on the datastore (it
doesn't put the child when you put the person), otherwise you get an "entity doesn't exists"
exception.

No annotation needed. I made it to detect if the type is registered.
Collections also magically worked.

Please, review it for me, either if you won't include it to trunk.

All test passed and I have added a few more. Regards

"interface com.googlecode.objectify.Objectify is not visible from class loader" in some cases

Original issue 3 created by objectify on 2010-01-23T17:26:54.000Z:

What steps will reproduce the problem?
When using FetchOptions I've got exception
{{{
Caused by: java.lang.IllegalArgumentException: interface com.googlecode.objectify.Objectify is not visible from class
loader
at java.lang.reflect.Proxy.getProxyClass(Proxy.java:353)
at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:581)
at com.googlecode.objectify.DatastoreTimeoutRetryProxy.wrap(DatastoreTimeoutRetryProxy.java:30)
at com.googlecode.objectify.ObjectifyFactory.maybeWrap(ObjectifyFactory.java:137)
at com.googlecode.objectify.OPreparedQueryImpl$ToObjectIterable.<init>(OPreparedQueryImpl.java:122)
at com.googlecode.objectify.OPreparedQueryImpl.asList(OPreparedQueryImpl.java:79)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.google.appengine.tools.development.agent.runtime.Runtime.invoke(Runtime.java:100)
at com.googlecode.objectify.DatastoreTimeoutRetryProxy.invoke(DatastoreTimeoutRetryProxy.java:54)
at $Proxy24.asList(Unknown Source)
}}}

Code sample
{{{
Objectify ofy = ObjectifyService.begin();
OQuery<MyClass> q = ObjectifyService.createQuery(MyClass.class);
List<OKey<MyClass>> keys = ofy.prepareKeysOnly(q).asList(FetchOptions.Builder.withLimit(10));//ecxeption here
!!!
}}}
but next code (without FetchOptions) works.
{{{
Objectify ofy = ObjectifyService.begin();
OQuery<MyClass> q = ObjectifyService.createQuery(MyClass.class);
List<OKey<MyClass>> keys = ofy.prepareKeysOnly(q).asList();
}}}

What is the expected output? What do you see instead?
Must work

What version of the product are you using? On what operating system?
objectify-1.0.jar
Windows XP 32x
Eclipse Java EE IDE for Web Developers.Build id: 20090920-1017
Google Appengine 1.3.0 in Development Mode
Sun JDK 1.6u12

Please provide any additional information below.

Optimize startup/registration time

Original issue 36 created by objectify on 2010-05-10T02:06:56.000Z:

I clocked how much time the first call to register takes for a class and it
takes about 200ms. After that, each registration of a class takes 3ms to
40ms for my classes depending on the size of the class.

I'm fine with a few hundred milliseconds, but on the home page one of the
bullet points says, "Objectify does not impact application cold-start time,
adding a few milliseconds at most."

Is there a way to speed this up?

asSingle() produces NullPointerException when query returns no result

Original issue 1 created by objectify on 2010-01-21T00:06:04.000Z:

What steps will reproduce the problem?

  1. An empty database
  2. query returns no result with
    3.
    OQuery<User> query = fact().createQuery(User.class);
    query.filter(column, param);
    User user = null;
    OPreparedQuery<User> pq = ofy().prepare(query);
    user = pq.asSingle();

What is the expected output? What do you see instead?
Expected returning null asSingle(), but we have a NPE:

java.lang.NullPointerException
at
com.googlecode.objectify.OPreparedQueryImpl.asSingle(OPreparedQueryImpl.java:99)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
com.google.appengine.tools.development.agent.runtime.Runtime.invoke(Runtime.java:100)
at
com.googlecode.objectify.DatastoreTimeoutRetryProxy.invoke(DatastoreTimeoutRetryProxy.java:54)
at $Proxy8.asSingle(Unknown Source)
at com.miracle.server.dao.UserDao.getUser(UserDao.java:51)
at com.miracle.server.pe.Login.doPost(Login.java:57)
......

What version of the product are you using? On what operating system?
Objectify v1.0

Please provide any additional information below.

Maven Repo

Original issue 16 created by objectify on 2010-02-05T10:42:11.000Z:

Hello,

I like you lightweight abstraction on top of the datastore. I was just about
to start something similar for my own project.

Many people (including me) like to manager their build time dependencies with
Maven so it would be great if you could provide a Maven repo for your SVN
trunk. You may have a look at the provided example here:
http://www.thewebsemantic.com/2009/04/11/your-very-own-google-code-maven-
repo/

Tobias Neef

Port documentation from googlecode

Given that google code is closing. Should there be a task to port the documentation to Github?

I am happy to volunteer time to do so.

Concepts documentation

Original issue 8 created by objectify on 2010-01-30T05:40:51.000Z:

"However, when you lookup or reference your object, you do so by OKey."
That should be "look up", not "lookup".

NullPointerException when invoking put() method with a null object

Original issue 40 created by objectify on 2010-05-27T16:44:35.000Z:

Not sure if it is a design decision to throw the NPE, but would vote for just ignoring null objects, or
throwing a proper dedicated exception. The stacktrace shows the spot:

java.lang.NullPointerException
at com.googlecode.objectify.ObjectifyFactory.getMetadataForEntity(ObjectifyFactory.java:219)
at com.googlecode.objectify.impl.ObjectifyImpl.put(ObjectifyImpl.java:183)
at de.fasthome.gae.ods.AdManager.putRealEstateAd(AdManager.java:80)
at de.fasthome.server.UploadManager.doPost(UploadManager.java:261)

allocateIds does not operator within the kind namespave

Original issue 44 created by objectify on 2010-06-25T15:44:36.000Z:

I would have expected ObjectifyFactory's allocateIds(java.lang.Class<T> clazz, long num) to preallocate a contiguous range of unique ids within the namespace of the specified entity class.

It appears to allocated ids paying no attention to the namespace.

I have attached an updated AllocateTests for verification.

Implement separation of lifecycle event handling from entity

Original issue 39 created by objectify on 2010-05-26T22:15:52.000Z:

As discussed in the following thread:

http://groups.google.com/group/objectify-appengine/browse_thread/thread/d3cde5bb408f839

and proposed by Scott and Jeff, please implement an additional lifecycle event handling not within
the entity class itself, but rather as an external EventListener.

The following reference shows the equivalent Hibernate design:

http://docs.jboss.org/hibernate/stable/entitymanager/reference/en/html/listeners.html

2 dimensional array is unsupported?

Original issue 37 created by objectify on 2010-05-19T05:25:55.000Z:

What steps will reproduce the problem?

  1. Update HasArrays.java to include:
    public int[][] ints2;
  2. Run the unit tests: ant test
  3. Note testIntArrays() FAILS:
    ints2: java.util.ArrayList is not a supported property type.

Objectify v2.2.

Serialization of OKey's Class<T>

Original issue 5 created by objectify on 2010-01-26T21:09:18.000Z:

What steps will reproduce the problem?

  1. Create serializable type MyType
  2. Use an OKey<MyType> as a return object in GWT-RPC
  3. Attempt to run

What is the expected output? What do you see instead?
java.lang.Class<T> is not assignable to
'com.google.gwt.user.client.rpc.IsSerializable' or
'java.io.Serializable' nor does it have a custom field serializer
(reached via
com.googlecode.objectify.OKey<com.whatever.Myclass>)

What version of the product are you using? On what operating system?
GWT 2.0 on Ubuntu Linux

Please provide any additional information below.

Looks like the serialization of OKey is having trouble with it's Class<?
extends T> field.

Key should have getKind() not getKindClassName() if possible

Original issue 14 created by objectify on 2010-02-04T23:01:28.000Z:

Key used to have a getKind(), but that was changed to
getKindClassName() for GWT serialization purposes. I'd like that try
and change that back, if I can work out how to still get it to work
with serialization. Using Kind instead of KindClassName seems more
orthogonal to the datastore Key's class.

From http://groups.google.com/group/objectify-appengine/msg/bf8d30ffa59d0f6e

OnestoreEntity memory leak

Original issue 38 created by objectify on 2010-05-23T21:17:53.000Z:

Running queries and seeing memory consumption go way up due to these
classes not being GC'ed...

com.google.storage.onestore.v3.OnestoreEntity$PropertyValue 66,840,592
com.google.storage.onestore.v3.OnestoreEntity$Property 47,743,240

The number to the right is the heap size in memory. Memory looks okay in
com.googlecode.objectify, and in my package. Scoping the app w/ JProbe.

Perhaps it's due to DB connections not being closed, found this...

http://groups.google.com/group/google-appengine-
java/browse_thread/thread/afc98d9a853601d2

Wondering about the objectify connection session, and the lack of a close()
call. Perhaps the wiki could contain some info about this?

Gonna need to get to the bottom of this soon, as my app can only run for a
couple hours before running out of memory.

Objectify v2.2. GAE v1.3.4.

Memcache Namespace is Invalid from SDK 1.3.4 Onwards

Original issue 45 created by objectify on 2010-06-29T16:51:59.000Z:

The name of the MemCache namespace which is declared in the CachingDatastoreService class is invalid from GAE SDK 1.3.4 onwards.

This isn't a problem if you continue to use the deprecated setNamespace method on the MemcacheService object, but if you use the correct static method on the MemcacheServiceFactory to obtain a namespace-aware MemcacheService then it fails.

The error which is thrown is:

java.lang.IllegalArgumentException: Namespace 'Objectify Cache' does not match pattern '[0-9A-Za-z._-]{0,100}'.
at com.google.appengine.api.NamespaceManager.validateNamespace(NamespaceManager.java:154)
at com.google.appengine.api.memcache.MemcacheServiceImpl.<init>(MemcacheServiceImpl.java:163)
at com.google.appengine.api.memcache.MemcacheServiceFactory.getMemcacheService(MemcacheServiceFactory.java:45)

Allow @Key as a replacement for @Id/@Parent

Original issue 21 created by objectify on 2010-02-08T18:52:42.000Z:

In lieu of using @Id/@parent, entity pojos could be written with a Key<?>,
Key, or String field annotated with @key:

class Foo {
@key String key;
...
}

This would store a stringified version of the Key for the entity in the entity.

Queries would treat the key as a single component, just like the native
datastore.

An entity with a Cached annotation is not flushed when put in a transaction

Original issue 30 created by objectify on 2010-04-06T01:43:24.000Z:

I created an entity that had an @parent(so as to be part of a specific entity group)
and was annotated with @cached. This entity has a simple List member.
My test created the entity with O1 (O for Objectify).

The entity was read with O2 (O2 was a transactional Objectify) and an item was added to
the List. Item was put and committed using O2.

The entity was read with O3 and the size of the List was printed. It remained zero.

I re-did the above using a non-trasnactional O2 and the size of the List when printed
was 1.

Support @Embedded Interfaces

Original issue 32 created by objectify on 2010-04-26T08:28:28.000Z:

What steps will reproduce the problem?

  1. Have embedded class structure similar to the intro wiki (i.e.
    EntityWithEmbedded, LevelOne, LevelTwo)
  2. Modify LevelOne to be a generic class LevelOne<T>
  3. Create interface class for LevelTwo (LevelTwoInterface). This is
    "extract interface" in eclipse Refactor menu.
  4. Instead of LevelOne embed LevelTwo. Have it LevelOne<T> embed T
    class. This T class will eventually be set as LevelTwoInterface.
  5. Create the classes hierarchy and store it. Storing is
    successful.
  6. Retrieve EntityWithEmbedded and note that LevelTwo is null.
    EntityWithEmbedded and LevelOne is fine.

Expected output? What do you see instead?

  1. Storing the embedded class hierarchy does not result to
    exception. If generic class can not be save, then at least I expect
    to see exception here telling me that I can not do this.
  2. More importantly expected that generic class is embeddable and
    can be stored using objectify. This is not the case since when the
    entire hierarchy is retrieved LevelTwo object is return as null.
  3. The wiki does not mention whether generic object can be stored
    or not. So this is a gray area.

What version of the product are you using?

Objectify 2.1
AppEngine 1.3.2
GWT 2.0.3
Eclipse Build id: 20100218-1602

On what operating system?

Ubuntu Karmic

Please provide any additional information below.

Attached a sample eclipse+AppEngine+gwt workspace/project.

Introduction to Objectify documentation

Original issue 18 created by objectify on 2010-02-07T07:45:24.000Z:

In the Relationships section you say "Note that this is an inappropriate
use of the @parent entity; if a car were to be sold to a new owner, you
would need to delete the Car and create a new one." You could add
something explaining that the Google App Engine data store has the
restriction that it doesn't allow reparenting. Or maybe add it further
below, where you tell about changing the @parent key field doesn't do what
might be expected.

Near the end of the Transactions section: nontrasactional -> nontransactional

At the beginning you say "You can persist any of the core value types,
collections of the core value types". You could add a remark saying that
this does not include Maps, for dunderheads like me who forget that Map
isn't a subinterface of Collection.

What happen to ofy.query?

Original issue 19 created by objectify on 2010-02-08T04:21:41.000Z:

What steps will reproduce the problem?

  • As in the introduction Querying section:

    Objectify ofy = ObjectifyService.begin();
    Car car = ofy.query(Car.class).filter("vin", "123456789").get();

  • query as in ofy.query is missing or not defined

What version of the product are you using? On what operating system?

objectify 1.0.3 (latest) Appengine 1.3 GWT 2.0

Query.get() does not honor a Cursor constraint, if set

Original issue 24 created by objectify on 2010-02-25T11:36:38.000Z:

Query<Trivial> q = ofy.query(Trivial.class).filter("someString =", "foo");
q.limit(20).cursor(cursor);
Trivial gotten = q2.get();
assert gotten.getId().equals(objectAfterCursor.getId());

Better Indexing Controls (@Indexed/@Unindexed)

Original issue 20 created by objectify on 2010-02-08T06:26:01.000Z:

We need to create an @indexed annotation. In the current incarnation this
is implied for all fields, but with @Embedded (+@Unindexed) it can be
disabled for a whole class, and object graph. Unfortunately that leaves us
no way to index a (set of, or single) property of the embedded object which
is marked with @Unindexed.

In addition, both of these annotations should be applicable for the type
and field. The annotation on the type (class-level) should be the default
for all fields in that class unless explicitly decorated.

I got java.lang.NoSuchMethodError after updating to 4.03b.

This is the error:
Caused by: java.lang.NoSuchMethodError: com.googlecode.objectify.cmd.Query.first()Lcom/googlecode/objectify/LoadResult;

I only updated to the latest one cause version 4.2b (for some odd reason) doesn't have the now() method when loading an entity.

Should I provide more info?

Concepts documentation

Original issue 9 created by objectify on 2010-01-30T05:47:30.000Z:

"but don't forget that this is really just creating a OKey and calling get()!"

"an OKey" not "a OKey".

possible logical bug during key creation

Original issue 43 created by objectify on 2010-06-23T01:58:17.000Z:

I discovered a sneaky bug, which can happen due to a developer's mistake.

class Party {
@id Long id
....
}

In one of my UI screens, I do a post of id (from the above Party), and on the server, that
'id' is received as a String. Hence, the Party key can be created using String id.
Key<party> key = new Key(Party.class, id)
ofy.get(key)
I will never get the Party entity back, because the Party was creating using the long id.

The Keys constructed with 'String id' and 'long id' are different.

Can any error checking be done while creating the Objectify Key.

Implement "unactivated entities" as a surrogate for Key<?>

Original issue 41 created by objectify on 2010-06-15T16:50:27.000Z:

Similar to Twig, allow relationship references to be defined as entity classes instead of Keys:

{{{
class SomeEntity {
@id long id;
OtherEntity other;
}
}}}

The OtherEntity instance will contain only the Key information (id and parent) - there will be no separate fetch and thus the body of the entity will not be loaded from the database.

In order to populate this entity, a method will be added to Objectify:

Objectify.refresh(Object... entities)

Alternatively, the get() methods could be extended to take Object.

Beware, there are hazards to doing this - you now can have entity objects in your code which are uninitialized.

Automatic activation as per twig (or JDO) is not being considered at this time. Too much magic with strong performance implications.

Problem exporting Javadoc

Original issue 35 created by objectify on 2010-05-04T02:56:03.000Z:

What steps will reproduce the problem?

  1. Export Javadoc from Eclipse
    2.
    3.

What is the expected output? What do you see instead?
The output on the console is:

cannot access com.googlecode.objectify.Objectify
bad class file: [path]/objectify-2.2/objectify-2.2.jar(com/googlecode/objectify/Objectify.class)
class file has wrong version 50.0, should be 49.0
Please remove or make sure it appears in the correct subdirectory of the classpath.
import com.googlecode.objectify.Objectify;

What version of the product are you using? On what operating system?
Mac OS X 10.5.8
Objectify 2.2

Please provide any additional information below.
Everything runs fine during dev/testing, but when I try to export the Javadoc it barfs up that
error.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.