Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] NPE when updating entity where only @Element-collection has changed

In Eclipselink 2.5 SQLUpdateStatement.buildCallWithoutReturning used to throw exception:

if (fieldsForTable.isEmpty()) {
    throw QueryException.objectToInsertIsEmpty(getTable());
}

with the following message: "The list of fields to insert into the table [{0}] is empty.  You must define at least one mapping for this table."


On 5/2/2016 5:17 PM, Andreas Joseph Krogh wrote:
 
Hi.
 
I'm getting bitten by this again, using EL-2.6.2. No hints of what might cause this?
 
Thanks.
 
 
--
Andreas Joseph Krogh
CTO / Partner - Visena AS
Mobile: +47 909 56 963
 
 
På mandag 11. mai 2015 kl. 22:41:21, skrev Andreas Joseph Krogh <andreas@xxxxxxxxxx>:
Hi all.
 
I'm using EL-2.5.2 with PostgreSQL
 
I have one entity where the only field changed is an @ElementCollection, this results in the following code-path:
 
SQLUpdateStatement.buildCallWithoutReturning, line 64:
 
if (fieldsForTable.isEmpty()) {
    return null;
}
 
Then null is returned and assigned to the sqlCall-variable in SQLModifyStatement.buildCall:
 
public DatabaseCall buildCall(AbstractSession session) {
    SQLCall sqlCall = buildCallWithoutReturning(session); // null is returned here
    if ((getReturnFields() == null) || getReturnFields().isEmpty()) {
        return sqlCall;
    } else {
        return session.getPlatform().buildCallWithReturning(sqlCall, getReturnFields());
    }
}
 
Using the PostgreSQLPlatform, this is what happens:
 
public DatabaseCall buildCallWithReturning(SQLCall sqlCall, Vector returnFields) {
    SQLCall call = new SQLCall();
    call.setParameters(sqlCall.getParameters()); // BOOM NPE !!!!!!!!!!
 
Has anyone else seen or been bitten by this?
 
Thanks.
 
--
Andreas Joseph Krogh
CTO / Partner - Visena AS
Mobile: +47 909 56 963
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
 
 


_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/eclipselink-users


Back to the top