Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 329093

Summary: Null written as value when case difference in named parameter SQL and setParameter name
Product: z_Archived Reporter: Michael OBrien <michael.f.obrien>
Component: EclipselinkAssignee: Nobody - feel free to take it <nobody>
Status: CLOSED WONTFIX QA Contact:
Severity: minor    
Priority: P3 CC: eclipselink.foundation-inbox, tom.ware
Version: unspecifiedFlags: michael.f.obrien: documentation+
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Bug Depends on: 329092    
Bug Blocks: 325167    

Description Michael OBrien CLA 2010-10-29 15:13:10 EDT
>The following bind parameter call will fail when the cases do not match for

aQuery = entityManager.createNativeQuery("select * from table where id =
#anid....");
aQuery.setParameter("anId", 32); // force use of "anId" instead of "anid" to
test case-sensitivity

>in the following [value] will be null
DatasourceCall.translateQueryString():739
  Object value = getValueForInParameter(parameter, translationRow, modifyRow,
session, false);

org.eclipse.persistence.example.dataparallel.GridClient at localhost:52520    
    Thread [Main Thread] (Suspended)    
        SQLCall(DatasourceCall).translateQueryString(AbstractRecord,
AbstractRecord, AbstractSession) line: 739    
        SQLCall(DatabaseCall).translate(AbstractRecord, AbstractRecord,
AbstractSession) line: 985    
       
CallQueryMechanism(DatasourceCallQueryMechanism).executeCall(DatasourceCall)
line: 205    
        CallQueryMechanism(DatasourceCallQueryMechanism).executeCall() line:
192    
        CallQueryMechanism(DatasourceCallQueryMechanism).executeNoSelectCall()
line: 235    
        CallQueryMechanism(DatasourceCallQueryMechanism).executeNoSelect()
line: 215    
        DataModifyQuery.executeDatabaseQuery() line: 85    
        DataModifyQuery(DatabaseQuery).execute(AbstractSession, AbstractRecord)
line: 782    
        DataModifyQuery(DatabaseQuery).executeInUnitOfWork(UnitOfWorkImpl,
AbstractRecord) line: 685    
       
RepeatableWriteUnitOfWork(UnitOfWorkImpl).internalExecuteQuery(DatabaseQuery,
AbstractRecord) line: 2960    
        RepeatableWriteUnitOfWork(AbstractSession).executeQuery(DatabaseQuery,
AbstractRecord, int) line: 1303    
        RepeatableWriteUnitOfWork(AbstractSession).executeQuery(DatabaseQuery,
AbstractRecord) line: 1285    
        RepeatableWriteUnitOfWork(AbstractSession).executeQuery(DatabaseQuery,
List) line: 1259    
        EJBQueryImpl<X>.executeUpdate() line: 534    
        GridClient.nativeQuery() line: 119    
        GridClient.main(String[]) line: 353    

>The case must be the same for both the named SQL query parameter name and the setParameter("name", value) call
>this works
            aQuery.setParameter("anid", 32);

>trace
parameter    DatabaseField  (id=155)    
    name    "anid" (id=154)    
    nameForComparisons    null    
    qualifiedName    "anid" (id=154)    

    useUpperCaseForComparisons    false    
value    Integer  (id=106)    
    value    32 


--------------------------------------------------------------------------------
Comment 1 Eclipse Webmaster CLA 2022-06-09 10:24:41 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink