javaphpgoogle-app-enginequercus

how to use com.google.appengine.api.datastore.Text


i use Quercus to run php on google app engine and and i use below code to insert value to the GAE datastore (BigTable).

<?php
import com.google.appengine.api.datastore;
import com.google.appengine.api.datastore.Entity;
import com.google.appengine.api.datastore.DatastoreServiceFactory;

$entity = new Entity("test"); 
$entity->setProperty('story',' --- more than 500 char ---');
$dataService = DatastoreServiceFactory::getDatastoreService();
$dataService->put($entity);
?>

but return flowing error because story value is more than 500 char.

error:
com.caucho.quercus.QuercusException: com.google.appengine.api.datastore.Entity.setProperty: story: String properties must be 500 characters or less. Instead, use com.google.appengine.api.datastore.Text, which can store strings of any length.

i don't know any thing about java. Does anyone have any idea how to use com.google.appengine.api.datastore.Text in my php code.

thanks


Solution

  • Will this work?

    <?php
    import com.google.appengine.api.datastore;
    import com.google.appengine.api.datastore.Entity;
    import com.google.appengine.api.datastore.DatastoreServiceFactory;
    import com.google.appengine.api.datastore.Text;
    
    
    $entity = new Entity("test"); 
    $TextValue = new Text(' --- more than 500 char ---');
    $entity->setProperty('story',$TextValue);
    $dataService = DatastoreServiceFactory::getDatastoreService();
    $dataService->put($entity);
    ?>