Nick,
I've used a java loader in hosted mode (to spare the expense of doing it in
production) for all of my entities. When I load them locally, /_ah/admin
reports the simple name of the entity, with the right data. But my java code
needs to query with the full package name.
For instance, these work in hosted mode after entities loaded via Java
loader
- Query q = new Query(MyClass.class) // automatically passes full package
name
- Query q = new Query("package.MyClass") // manually pass full package
name
But these do not work in hosted mode after entities loaded via Java loader
- Query q = new Query("SELECT * FROM MyClass") // simple name fails to
map to package name
- Query q = new Query(MyClass.class.getSimpleName()) // simple name fails
to map to package name
I am hoping I have explained this correctly. I got so confused yesterday
trying to distinguish between:
- working / not working (ie JDO error)
- combined with hosted/production
- combined with python/java loaders
In your example at
http://blog.notdot.net/2009/9/Advanced-Bulk-Loading-Part-5-Bulk-Loading-for-Java
what
is the corresponding java package name for the python model "Film"? Do
<Film>s pushed via the bulk loader get returned when your Java code queries
for Film.class or "SELECT * FROM Film"?
I guess I am looking for validation (ie, working code) that entities pushed
with a python bulkloader can be queried properly using Java. Like I said, I
have probably got either the Query syntax wrong in the servlet or the
annotations wrong in the class.
If you add some Java code to the Film example, it would help immensely.
Stuart
On Wed, Nov 4, 2009 at 4:24 PM, Nick Johnson (Google) <
[email protected]> wrote:
> Hi Stuart,
>
> I'm not sure why this would be happening. Your best option might be to
> insert a record using Java, then check how it shows up in the admin console,
> and make sure to use the exact same name for the kind you use in the Java
> loader.
>
> -Nick Johnson
>
>
> On Wed, Nov 4, 2009 at 6:25 PM, Stuart Moffatt <[email protected]>wrote:
>
>> Maybe I didn't word my problem very well.
>>
>> Let me describe it again:
>>
>> Data push:
>> 1. I am bulkloading data to an app using python appcfg and custom
>> bulkloaders.
>> 2. The custom bulk loaders are pushing data from a CSV.
>> 3. The models of the data being pushed have simple names in python (no
>> package namespace)
>> 4. The entities all get successfully uploaded.
>>
>> Data query:
>> 1. The application that uses the data pushed via bulk loading is in
>> Java
>> 2. Because it's in Java, there is a package namespace for where my
>> entity classes exist
>> 3. App Engine is supposed to ignore the long package namespace and
>> just pick up the simple name (ie, the name of the class)
>> 4. These simple names are supposed to match the simple names of the
>> data that was pushed via bulk loading.
>>
>> The problem:
>> 1. Queries for the simple name via the admin interface return data as
>> expected
>> 2. Queries for the simple name via Java code do NOT return data as
>> expected. Instead I get a JDO error about the class not being found
>> (sorry, don't have my code in front of me to list the trace).
>> Basically, it seems that a query for a simple name throws an error
>> when that simple class name exists in a fully named package.
>>
>> I am using JDO annotations in my classes as per the tutorials. Is
>> there some magic that I am missing? Perhaps I am doing something wrong
>> with my annotations?
>>
>> I would rather post details, but wanted to get a handle on the general
>> problem before I bog down the list with a stack trace and entity code.
>>
>> Stuart
>>
>> On Nov 3, 5:06 pm, Stuart Moffatt <[email protected]> wrote:
>> > I am using Nick's excellent tutorials on bulk loading, and was able to
>> > push a huge pile of entities up to production. Problem is, they looked
>> > like this:
>> >
>> > MySpecialEntity
>> >
>> > in my custom python bulkloader class and in production.
>> >
>> > The gotcha is my application is Java, and queries for:
>> >
>> > SELECT FROM org.domain.app.MySpecialEntity
>> >
>> > fail because the Javanamespacewas not part of the python bulkloader.
>> >
>> > Anyone know a workaround?
>> >
>> > Stuart
>>
>
>
>
> --
> Nick Johnson, Developer Programs Engineer, App Engine
> Google Ireland Ltd. :: Registered in Dublin, Ireland, Registration Number:
> 368047
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google App Engine for Java" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/google-appengine-java?hl=en
-~----------~----~----~----~------~----~------~--~---