tags:

views:

109

answers:

1

Hello,

I am using oracle TopLink as a persistence layer with business logic implemented in java. I am using expression and expression builder class to get data from database. Problem is that in database table we donot have duplicate rows but when I query the database via ReadObjectQuery class I receive same quantity of rows as in database table but with first record duplicated each time such that all the rows show the first record.

Please help me as soon as possible

A: 

This behavior normally shows up, if the primary key fields that you've defined in your mapping aren't unique at all. What happens is, that Toplink retrieves the first row and converts it to a Java object. For the consecutive rows it seems that the defined primary key field is identical to the one from the first row. Therefore Toplink doesn't do the conversion again and loads the object with the same key from its cache, i.e. the object relating to the first row.

Christoph Metzendorf