I have a multi-level inheritance model which produces a query that runs
correctly in Toad (the query was obtained from the JPA trace) but
incorrectly populates the Java object model.  The InheritanceType.Joined
strategy is used.
Basically one of the tables in the hierachy has multiple rows selected for a
single row in the main join to table. That should yield unique values for
those columns for each row in the result set which it does when run in Toad.
However, while the correct number of Java objects are instantiated the
columns that should have unique values per row do not. The first or last
value is duplicated for each row.

For example the result set will have columns A, B ,C and D .. with D
representing the table with multiple selected rows and therefore has unique
values ..

A       B      C       D
1        2      3     4
1        2     3      5
1        2     3      6
1        2     3      7

However, there will be 4 Java objects created with the attribute for column
D set to a 4 for all four objects instead of each object having a unique
value for comlumn D. 

Here is the query (its kind of big due to many tables in the Object
hierachy):

SELECT t2.GRID_POINT_ID, t0.GRID_POINT_ID, t2.POINT_X, t2.POINT_Y,
t3.AGENCY, t3.CENSUS_DESIG_PLACE_DISTANCE, t3.GRID_POINT_ID,
t3.HOUSING_COST, 
t3.IN_HVR, t3.IN_WUI, t3.IN_WILDERNESS, t3.WILDERNESS_DISTANCE, t4.FPU_CODE,
t4.FPU_POINT_INDEX, t4.GRID_POINT_ID, t4.IN_BUFFER, t5.FPU_CODE,
t5.FWA_GIS_ID, 
t5.GRID_POINT_ID, t6.FPU_CODE, t6.ASPECT, t6.BASE_HEIGHT, t6.COVER,
t6.DENSITY, t6.ELEVATION, t6.GRID_POINT_ID, t6.HEIGHT,
t6.LANDSCAPE_DATASET_ID, 
t6.SLOPE, t1.FPU_CODE, t1.FUEL_MODEL_13, t1.FUEL_MODEL_40, t1.GRID_POINT_ID,
t1.LANDSCAPE_DATASET_ID, t1.PT_GRID_INDEX, t1.SCI_COST, t0.DAY_OF_YEAR, 
t0.DISCOVERY_TIME, t0.FM_HERB, t0.FM_100, t0.FM_1, t0.FM_10, t0.FM_WOOD,
t0.FPU_CODE, t0.LATITUDE, t0.LONGITUDE, t0.MODELED_IGNITION_ID, 
t0.SYS_STAT_CAUSE_ENUM, t0.WIND_SPEED, t0.YEAR FROM FPA2.MODELED_IGNITION
t0, FPA2.GRID_POINT_FUEL_MODEL_ATTR t1, FPA2.GRID_POINT_GIS t2, 
FPA2.GRID_POINT_COST_ATTR t3, FPA2.X_GRID_POINT_BUFFERED_FPU t4,
FPA2.GRID_POINT_FWA_ATTR t5, FPA2.GRID_POINT_FIRE_BEHAVIOR_ATTR t6 
WHERE (t1.LANDSCAPE_DATASET_ID = 12480 AND t0.FPU_CODE = 'CA_CA_008' AND
t0.YEAR >= 1 AND t0.YEAR <= 1) AND t0.GRID_POINT_ID = t1.GRID_POINT_ID AND
t0.FPU_CODE = t1.FPU_CODE AND t1.GRID_POINT_ID = t6.GRID_POINT_ID AND
t1.FPU_CODE = t6.FPU_CODE 
AND t1.LANDSCAPE_DATASET_ID = t6.LANDSCAPE_DATASET_ID AND t6.GRID_POINT_ID =
t5.GRID_POINT_ID AND t6.FPU_CODE = t5.FPU_CODE 
AND t5.GRID_POINT_ID = t4.GRID_POINT_ID AND t5.FPU_CODE = t4.FPU_CODE AND
t4.GRID_POINT_ID = t3.GRID_POINT_ID AND t3.GRID_POINT_ID = t2.GRID_POINT_ID


-- 
View this message in context: 
http://n2.nabble.com/Joined-result-set-mapped-to-Java-objects-incorrectly-tp3229831p3229831.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Reply via email to