Quantcast

NPE when updating entity where only @Element-collection has changed

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

NPE when updating entity where only @Element-collection has changed

Andreas Joseph Krogh-2
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
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: NPE when updating entity where only @Element-collection has changed

Andreas Joseph Krogh-2
 
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 <[hidden email]>:
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
[hidden email]
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
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: NPE when updating entity where only @Element-collection has changed

Mauro Molinari
I have no idea (I'm just an EclipseLink user like you and never used it with PostgreSQL), but... what if you compare the same buildCallWithReturning implementation on another SQLPlatform (MySQL or such)? Would it throw NPE as well if sqlCall is null?
You may understand if the problem is in the PostgreSQLPlatform or in the fact that sqlCall is null...

Mauro

Il 02/05/2016 23:17, Andreas Joseph Krogh ha scritto:
 
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 <[hidden email]>:
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
[hidden email]
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
[hidden email]
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
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: NPE when updating entity where only @Element-collection has changed

Andrei Ilitchev
In reply to this post by Andreas Joseph Krogh-2
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 <[hidden email]>:
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
[hidden email]
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
[hidden email]
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
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: NPE when updating entity where only @Element-collection has changed

Andreas Joseph Krogh-2
In reply to this post by Mauro Molinari
På tirsdag 03. mai 2016 kl. 09:08:54, skrev Mauro Molinari <[hidden email]>:
I have no idea (I'm just an EclipseLink user like you and never used it with PostgreSQL), but... what if you compare the same buildCallWithReturning implementation on another SQLPlatform (MySQL or such)? Would it throw NPE as well if sqlCall is null?
You may understand if the problem is in the PostgreSQLPlatform or in the fact that sqlCall is null...
 
The problem I'm facing is that buildCallWithoutReturning(session) retursn null, so I'm not really interested in what other platforms do when null is returned.
 
The strange thing is that this only happens when i retrieve an entity with LockModeType.PESSIMISTIC_WRITE, retrieving it using regular find() works ok.
This is related to my other thread "Property-change event fails because of IndirectSet.attributeName is null".
 
--
Andreas Joseph Krogh
CTO / Partner - Visena AS
Mobile: +47 909 56 963
 

_______________________________________________
eclipselink-users mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: NPE when updating entity where only @Element-collection has changed

Gary Roach
On 05/03/2016 03:40 PM, Andreas Joseph Krogh wrote:
På tirsdag 03. mai 2016 kl. 09:08:54, skrev Mauro Molinari <[hidden email]>:
I have no idea (I'm just an EclipseLink user like you and never used it with PostgreSQL), but... what if you compare the same buildCallWithReturning implementation on another SQLPlatform (MySQL or such)? Would it throw NPE as well if sqlCall is null?
You may understand if the problem is in the PostgreSQLPlatform or in the fact that sqlCall is null...
 
The problem I'm facing is that buildCallWithoutReturning(session) retursn null, so I'm not really interested in what other platforms do when null is returned.
 
The strange thing is that this only happens when i retrieve an entity with LockModeType.PESSIMISTIC_WRITE, retrieving it using regular find() works ok.
This is related to my other thread "Property-change event fails because of IndirectSet.attributeName is null".
 
--
Andreas Joseph Krogh
CTO / Partner - Visena AS
Mobile: +47 909 56 963
 


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

Postgresql is not a problem. Dango (pydev) has its own internal database engine that can be used for development work. I never got that far with my setup before conflicts started.

Gary R.

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