Main Overview Wiki Issues Forum Build Fisheye
Issue Details (XML | Word | Printable)

Key: CMP-886
Type: Improvement Improvement
Status: Open Open
Priority: Minor Minor
Assignee: Shay Banon
Reporter: Richard King
Votes: 0
Watchers: 0

If you were logged in you would be able to see more operations.

Improved Google App Engine JPA support

Created: 27/Jul/09 11:38 AM   Updated: 30/Jul/09 03:03 AM
Component/s: Compass::Gps
Affects Version/s: 2.3.0 beta1
Fix Version/s: None

 Description  « Hide
See thread here for more info :

Essentially, the JPA queries need modifying such that they use the fully qualified class name of any entities and also aliases must be specified in the query (rather than implied), an example query format is

select x from com.whatever.Entity x

Effectively this fix only requires changes to DatanucleusJpaEntitiesLocator and EntityInformation as detailed in the post linked above.

For obvious reasons it is essential that when using JPA on AppEngine the SameThreadParallelIndexExecutor is used.

 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Shay Banon added a comment - 29/Jul/09 10:16 AM
In that same thread it was suggested that the new GAE version does support it. Maybe it makes sense to verify that this issue still applies to the latest GAE.

Richard King added a comment - 29/Jul/09 10:26 AM
I'm afraid the issue at least partly still applies. It may be that the fully qualified path name is no longer a requirement but the trailing 'x' still appears to be. I updated the thread with my tests on this, will feedback any more info I find.

Shay Banon added a comment - 29/Jul/09 12:33 PM
I have just committed a fix to add the trailing x in the DatanucleusJpaEntitiesLocator. I will kick a nightly build, can you give it a go?

Richard King added a comment - 30/Jul/09 02:14 AM
Good news! That seems to have done the trick CMPTRK-NIGHTLY-542 works fine in my local testing for indexing and searching using GAE/JPA without any further modification.

For the record this is the device configuration I'm using.


compass = new CompassConfiguration()
(Converter) (new KeyConverter())).buildCompass();

compassGps = new SingleCompassGps(compass);

CompassGpsDevice device = new JpaGpsDevice("appengine", emfInstance);

((JpaGpsDevice) device)
.setParallelIndexExecutor(new SameThreadParallelIndexExecutor());


if(compass.getSearchEngineIndexManager().isLocked()){ compass.getSearchEngineIndexManager().releaseLocks(); }




Shay Banon added a comment - 30/Jul/09 02:17 AM
Great stuff!. Can you post your Key converter (I think you posted it in the forum somewhere)? I will add it as a built in feature in Compass...

Richard King added a comment - 30/Jul/09 03:03 AM
Sure, happy to be of help.

import org.compass.core.converter.ConversionException;
import org.compass.core.converter.basic.AbstractBasicConverter;
import org.compass.core.mapping.ResourcePropertyMapping;
import org.compass.core.marshall.MarshallingContext;



  • Compass converter for
    public class KeyConverter extends AbstractBasicConverter<Key> {

protected Key doFromString(String keyString, ResourcePropertyMapping arg1,
MarshallingContext arg2) throws ConversionException { return KeyFactory.stringToKey(keyString); }

protected String doToString(Key key, ResourcePropertyMapping resourcePropertyMapping, MarshallingContext context){ return KeyFactory.keyToString(key); }


Richard King added a comment - 30/Jul/09 03:03 AM
(sorry about the formatting, got a bit messed up posting through jira)