[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [eclipselink-users] getResultList causes QueryException Primary key is null
|
This has worked on other queries I have used before. Here is the driver / db
info reported by eclipselink
Database: DB2 UDB for AS/400 Version: 05.04.0000 V5R4m0
Driver: AS/400 Toolbox for Java JDBC Driver Version: 8.2
I can provide examples of one that is working if needed.
Thanks for the reply.
James Sutherland wrote:
>
> There are no field names in your row, this is causing the error. This
> means that your JDBC driver is not returning any column names in its
> ResultSetMetaData, without the field names, EclipseLink has no way to map
> the results. What database and JDBC driver are you using? It seems that
> it does not support meta-data.
>
>
>
> khaskett wrote:
>>
>> Trying to execute a namedQuery using a result class. I am getting a
>> QueryException (EclipseLink-6044) -
>> The primary key read from the row [DatabaseRecord(
>> => 44
>> => /Account
>> => Action that selects /Account/Search or /Account/Details.
>> => U
>> => N
>> => 0)]
>> during the execution of the query was detected to be null. Primary keys
>> must not contain null.
>>
>> From the looks of the error message all my fields are coming back
>> correctly from the sql call.
>>
>> Here is the entity result class I am trying to use.
>> @NamedNativeQuery(
>> name = "findCpSecuredFeatureList",
>> query = "select distinct s.feature_id, s.feature_name,
>> s.feature_desc, s.feature_type, s.license_check, rs.privilege_level "
>> + "from cp_secured s, cp_role_secured rs, cp_userrole ur "
>> + "where s.feature_id = rs.feature_id and
>> ur.role_code=rs.role_code and ur.user_id=? "
>> + "order by rs.privilege_level desc, s.feature_name",
>> resultClass = CpSecuredFeature.class
>> )
>> @Entity
>> public class CpSecuredFeature extends BaseDomain {
>>
>> private static final long serialVersionUID = -3727509833171729708L;
>>
>> @Id
>> @Column(name = "feature_id")
>> private Long featureId;
>>
>> @Column(name = "feature_name")
>> private String featureName;
>>
>> @Column(name = "feature_desc")
>> private String featureDescription;
>>
>> @Column(name = "feature_type")
>> private String featureType;
>>
>> @Column(name = "license_check")
>> private boolean licenseRequired;
>>
>> @Column(name = "privilege_level")
>> private int privilegeLevel;
>> .....
>>
>> Any ideas on why this is happening?
>>
>
>
--
View this message in context: http://www.nabble.com/getResultList-causes-QueryException-Primary-key-is-null-tp20671004p20682075.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.