[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
| 
Re: [eclipselink-users] NullPointerException in	PersistenceObjectAttributeAccessor
 | 
You might want to look at how FreeResponse is mapped.  What is the @Id, is there 
a way a component of the @Id can be unexpectedly made null by the user.
How is the query executed?  Is there a result set mapping?
-Tom
Laird Nelson wrote:
I noticed that too; simple bug; should have been t.freeResponseIds.
The query itself is actually dynamic and the table name is supplied at 
query build time.  The intent is to turn this native query into a set of 
entities, which works fine.
(There is a set of tables in my application that are under the control 
of the user; they all share these fields in common.  Through various 
gyrations of the app, the user can pick which table to build normalized 
entities out of; this native query gets assembled from the table name.  
So a simple entity mapping doesn't work, because the table name is not 
known at compile/startup time.)
I'll keep an eye on this and see if I can narrow down what I was doing 
when it happens again.  I cannot reproduce this in a unit test (I've 
tried, believe me).
Best,
Laird
On Mon, Jan 10, 2011 at 9:39 AM, Tom Ware <tom.ware@xxxxxxxxxx 
<mailto:tom.ware@xxxxxxxxxx>> wrote:
    This exception seems to occur when trying to set a value in a null
    object.  I am not sure what would cause EclipseLink to try to do
    that.  Can you provide any other information about what is occuring?
    I notice that your example query selects "freeResponseIds" but does
    not link it to anything else in your query. (i.e. you select t.id
    <http://t.id>, t.text with "t." but freeResponseIds without the
    "t.") What is the goal here?
    -Tom
    Laird Nelson wrote:
        I have an application that runs a simple JPA native query.  99
        out of 100 times the query works fine.  Then every now and again
        I get this:
        Caused by: java.lang.NullPointerException
           at
        org.eclipse.persistence.internal.descriptors.PersistenceObjectAttributeAccessor.setAttributeValueInObject(PersistenceObjectAttributeAccessor.java:46)
           at
        org.eclipse.persistence.mappings.DatabaseMapping.setAttributeValueInObject(DatabaseMapping.java:1426)
           at
        org.eclipse.persistence.mappings.DatabaseMapping.readFromRowIntoObject(DatabaseMapping.java:1317)
           at
        org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildAttributesIntoObject(ObjectBuilder.java:343)
           at
        org.eclipse.persistence.internal.descriptors.ObjectBuilder.refreshObjectIfRequired(ObjectBuilder.java:3333)
           at
        org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildWorkingCopyCloneFromRow(ObjectBuilder.java:1495)
           at
        org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObjectInUnitOfWork(ObjectBuilder.java:559)
           at
        org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObject(ObjectBuilder.java:496)
           at
        org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObject(ObjectBuilder.java:455)
           at
        org.eclipse.persistence.queries.ObjectLevelReadQuery.buildObject(ObjectLevelReadQuery.java:723)
           at
        org.eclipse.persistence.queries.ReadAllQuery.registerResultInUnitOfWork(ReadAllQuery.java:743)
           at
        org.eclipse.persistence.queries.ReadAllQuery.executeObjectLevelReadQuery(ReadAllQuery.java:424)
           at
        org.eclipse.persistence.queries.ObjectLevelReadQuery.executeDatabaseQuery(ObjectLevelReadQuery.java:1080)
           at
        org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:808)
           at
        org.eclipse.persistence.queries.ObjectLevelReadQuery.execute(ObjectLevelReadQuery.java:1040)
           at
        org.eclipse.persistence.queries.ReadAllQuery.execute(ReadAllQuery.java:384)
           at
        org.eclipse.persistence.queries.ObjectLevelReadQuery.executeInUnitOfWork(ObjectLevelReadQuery.java:1126)
           at
        org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2904)
           at
        org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1508)
           at
        org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1490)
           at
        org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1464)
           at
        org.eclipse.persistence.internal.jpa.EJBQueryImpl.executeReadQuery(EJBQueryImpl.java:484)
           at
        org.eclipse.persistence.internal.jpa.EJBQueryImpl.getResultList(EJBQueryImpl.java:741)
        Once the query has failed in this manner, it will continue to
        fail until application restart.
        I am using the EclipseLink version that is bundled with
        Glassfish 3.1b36.
        My query is SELECT t.id <http://t.id> <http://t.id> AS ID,
        'FreeResponse' AS ANSWERSETNAME, t.text AS TEXT, freeResponseIds
        AS FREERESPONSEIDS FROM FreeResponse t
        What is EclipseLink trying to tell me here?
        Thanks,
        Laird
        ------------------------------------------------------------------------
        _______________________________________________
        eclipselink-users mailing list
        eclipselink-users@xxxxxxxxxxx <mailto:eclipselink-users@xxxxxxxxxxx>
        https://dev.eclipse.org/mailman/listinfo/eclipselink-users
    _______________________________________________
    eclipselink-users mailing list
    eclipselink-users@xxxxxxxxxxx <mailto:eclipselink-users@xxxxxxxxxxx>
    https://dev.eclipse.org/mailman/listinfo/eclipselink-users
------------------------------------------------------------------------
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users