Well, I sort-of figured out what was going on.  My boolean property
was called "isAdmin".  The getter was "public boolean isAdmin()
{ return isAdmin }", which seems to be the problem (in this case the
property-name didn't match up with the getter function name.  The
boolean property should have just been 'admin' to go along with the
"isAdmin()" getter).

Is this a bug?  I'm annotating the getter (as opposed to annotating
the property) -- must the getter function exactly match the property
for Enhancement to work?

Thanks!

david

On Jan 7, 7:36 pm, David Fuelling <[email protected]> wrote:
> I have an Entity that has a Set<String> and a boolean property.  The
> Entity enhances just fine, but when I try to do any sort of data
> operations with the Entity, I get a ClassCastException (see stack
> trace below).  Removing the boolean property from the Entity makes
> this error go away.
>
> To reproduce, you can download the sample code attached to this bug
> (http://code.google.com/p/googleappengine/issues/detail?id=2541), add
> a boolean property to the UserImpl object, and then run the JUnit test
> called "UserDAOTests.java".
>
> Here's the stack trace:
>
> java.lang.ClassCastException: java.lang.Boolean cannot be cast to
> java.util.Collection
>         at
> org.datanucleus.store.appengine.TypeConversionUtils.pojoValueToDatastoreValue
> (TypeConversionUtils.java:619)
>         at
> org.datanucleus.store.appengine.DatastoreFieldManager.storeObjectField
> (DatastoreFieldManager.java:782)
>         at
> org.datanucleus.store.appengine.DatastoreFieldManager.storeBooleanField
> (DatastoreFieldManager.java:915)
>         at org.datanucleus.state.AbstractStateManager.providedBooleanField
> (AbstractStateManager.java:911)
>         at
> com.sappenin.appengine.bugfix.server.model.impl.UserImpl.jdoProvideField
> (UserImpl.java)
>         at
> com.sappenin.appengine.bugfix.server.model.impl.UserImpl.jdoProvideFields
> (UserImpl.java)
>         at org.datanucleus.state.JDOStateManagerImpl.provideFields
> (JDOStateManagerImpl.java:2715)
>         at
> org.datanucleus.store.appengine.DatastorePersistenceHandler.insertPreProcess
> (DatastorePersistenceHandler.java:318)
>         at
> org.datanucleus.store.appengine.DatastorePersistenceHandler.insertObjects
> (DatastorePersistenceHandler.java:236)
>         at
> org.datanucleus.store.appengine.DatastorePersistenceHandler.insertObject
> (DatastorePersistenceHandler.java:225)
>         at org.datanucleus.state.JDOStateManagerImpl.internalMakePersistent
> (JDOStateManagerImpl.java:3185)
>         at org.datanucleus.state.JDOStateManagerImpl.flush
> (JDOStateManagerImpl.java:4513)
>         at org.datanucleus.ObjectManagerImpl.flushInternal
> (ObjectManagerImpl.java:2814)
>         at org.datanucleus.ObjectManagerImpl.flush(ObjectManagerImpl.java:
> 2754)
>         at org.datanucleus.ObjectManagerImpl.preCommit(ObjectManagerImpl.java:
> 2893)
>         at org.datanucleus.TransactionImpl.internalPreCommit
> (TransactionImpl.java:369)
>         at org.datanucleus.TransactionImpl.commit(TransactionImpl.java:256)
>         at org.datanucleus.jpa.EntityTransactionImpl.commit
> (EntityTransactionImpl.java:104)
>         at
> com.sappenin.appengine.bugfix.server.model.test.UserDAOTests.testSingleCreate
> (UserDAOTests.java:70)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at sun.reflect.NativeMethodAccessorImpl.invoke
> (NativeMethodAccessorImpl.java:39)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke
> (DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:597)
>         at junit.framework.TestCase.runTest(TestCase.java:168)
>         at junit.framework.TestCase.runBare(TestCase.java:134)
>         at junit.framework.TestResult$1.protect(TestResult.java:110)
>         at junit.framework.TestResult.runProtected(TestResult.java:128)
>         at junit.framework.TestResult.run(TestResult.java:113)
>         at junit.framework.TestCase.run(TestCase.java:124)
>         at junit.framework.TestSuite.runTest(TestSuite.java:232)
>         at junit.framework.TestSuite.run(TestSuite.java:227)
>         at org.junit.internal.runners.JUnit38ClassRunner.run
> (JUnit38ClassRunner.java:79)
>         at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run
> (JUnit4TestReference.java:46)
>         at org.eclipse.jdt.internal.junit.runner.TestExecution.run
> (TestExecution.java:38)
>         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests
> (RemoteTestRunner.java:467)
>         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests
> (RemoteTestRunner.java:683)
>         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run
> (RemoteTestRunner.java:390)
>         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main
> (RemoteTestRunner.java:197)
-- 
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.


Reply via email to