views:

26

answers:

1

I cant imagine any more methods to solve my problem. Here's a thread I made yesterday that describes the parent and child class in detail: http://stackoverflow.com/questions/3800450/many-to-one-unidirectional-gae-jdo-relationship-amongst-entities

I'm trying to add a Truck and persist it, but the persistence manager insists that the primary key of the parent item is NULL, even though I log the value prior to persisting the child, and the parent is NOT null, in fact its the valid key it should be set too. Why is the persistence manager seeing something that I'm not?

try{
        if (!findTruck(truck)){
                _logger.warning("get tweeter key " + truck.getTweeter().getEncodedKey());           
                pm.makePersistent(truck);   
                }
        }
        finally {
            pm.close();             
        }

from the logs:

09-27 06:37PM 12.158
com.google.truxmap.server.TruckJdoDAO addTruck: get tweeter key agp0cnV4bWFwcGVych8LEgdUd2VldGVyIhJrZXltdW5jaGllbWFjaGluZTEM
W 09-27 06:37PM 12.160
com.google.truxmap.server.TruckJdoDAO addTruck: addTruck exception: class java.lang.IllegalStateException. Message:Primary key for object of type Tweeter is null.
A: 

perhaps the parent is not persistent state, but is detached ? or transient? why not print out the state of the object