google-code-export / objectify-appengine

Automatically exported from code.google.com/p/objectify-appengine
MIT License
1 stars 0 forks source link

Instantiation of Key<T> does not work with GWT on client side with 3.0 (works with 2.2.3) #86

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1. Create an entity class "MyEntity" in a GWT project
2. Instantiate a Key object with the entity class on client side

String id = "myId";
Key<MyEntity> key = new Key<MyEntity>(MyEntity.class, id);

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

When trying to compile, the GWT compiler produces an error message:
"The constructor Key<MyEntity>(Class<MyEntity>, String) is undefined"

What version of the product are you using? On what operating system?
Eclipse 3.6 on Windows 7
GAE SDK 1.4.3
GWT SDK 2.2.0
Objectify 3.0

Please provide any additional information below.

The issue does not appear with Objectify 2.2.3
The type of the @id does not matter, same for String and Long

Original issue reported on code.google.com by decentz...@googlemail.com on 29 Apr 2011 at 11:05

GoogleCodeExporter commented 9 years ago
Any news about this? any workaround?

Original comment by pablo.ca...@gmail.com on 15 Aug 2011 at 4:23

GoogleCodeExporter commented 9 years ago
Looks like Key constructor that accepts a raw datastore key is still supported 
on the client.

So using the datastore key factory to generate a datastore key and then creating
an Objectify key using that seems to work.

Key Factory
com.google.appengine.api.datastore.KeyFactory

Key<Person> key = new Key<Person>(KeyFactory.createKey(null, "Person", 
personObj.dataStoreId));

I got this from looking at the code found here
http://code.google.com/p/objectify-gwtkey/

Original comment by virtualb...@gmail.com on 15 Oct 2011 at 7:22

GoogleCodeExporter commented 9 years ago
Since the gwt code is no longer part of Objectify core, this needs to be 
reopened at https://code.google.com/p/objectify-gwt/

Original comment by lhori...@gmail.com on 14 Apr 2014 at 12:14