0
votes

I've an appengine connected android project with GCM working. Now, I want to connect Mysql instance, on my localhost, to the appengine application. I've followed these instructions, but in vain.

The table on local mysql instance looks like this

+---------+-------------+------+-----+---------+----------------+
| Field   | Type        | Null | Key | Default | Extra          |
+---------+-------------+------+-----+---------+----------------+
| _ID     | bigint(5)   | NO   | PRI | NULL    | auto_increment |
| COLUMN1 | varchar(20) | NO   |     | NULL    |                |
+---------+-------------+------+-----+---------+----------------+

I'm trying to add a row to this table using endpoints. However, the appengine project, repeatedly, keeps adding rows to the local datastore.

Also, in the documentation EclipseLink is used. On one hand, datanucleus libraries are added by default to the appengine project and then JPA with EclipseLink documentation comes about. The documentation is confusing.

Should I use datanucleus or EclipseLink? I've tried both the ways and have failed. Endpoints use Datanucleus libraries. For example Endpoints use JPACursorHelper class which is in Datanucleus. What I'm trying to achieve is add a row to the above table, using endpoints, on the local appengine development.

Please note:

  1. I've an annotated Test.java class for which I've generated an endpoint class.
  2. I've added <class> tag to the persistence.xml.
  3. Annotation processor is configured with Datanucleus.
  4. The Database Development perspective shows that local instance is connected.
  5. My preference is Datanucleus.
1
JPACursorHelper is a class of use with GAE/Datastore (aka BigTable) database, not RDBMS, and actually does very little - see code.google.com/p/datanucleus-appengine/source/browse/trunk/src/… . You should use the JPA persistence implementation you wish to use, since that is the whole point of having an API (JPA) ... that doc page you reference says "Choose a JPA implementation of your choice", that's all there is to do - DataNucleus
DataNucleus, Thanks for your prompt reply. A new row is being inserted through insertTest method in TestEndpoint.java. On going through the file again I find that JPACursorHelper is not obstructing(atleast for insert). Please correct me if I'm wrong. - Harshal Kshatriya
Does it imply that the generated endpoints work only with Datastore? - Harshal Kshatriya

1 Answers

1
votes

Your "TestEndpoint" class won't work since it is AppEngine/Datastore-specific (using that JPACursorHelper class). You need to write a class using standard JPA features ... whatever that method is trying to do. Use GAE-specific features and you lose portability.