seems OJB assumes received object is a 'new' object.
If you use primitive types for PK and FK fields (int, long, ...) in your persistence capable objects, OJB has to determine which value is the 'null' representation. Currently OJB assume a primitive field is 'null' when it's value is '0'.
1083076041971|0|0|statement|SELECT A0.TITLE,A0.DESCR,A0.GOAL_ID,A0.OBJECTIVE,A0. ID FROM FP_OBJECTIVE A0 WHERE A0.ID IN ( ? )|SELECT A0.TITLE,A0.DESCR,A0.GOAL_ID ,A0.OBJECTIVE,A0.ID FROM FP_OBJECTIVE A0 WHERE A0.ID IN ( '0' )
seems that the retrieved object has 0 as PK value. Now the question, do you use primitive PK fields?
regards Armin
Mindy Pereira wrote:
I'm seeing some very strange behavior when I try to retrieve the ObjectiveBean from the relationship described below:
<class-descriptor class="appian.fhysp.beans.ProgObjBridgeBean"
table="FP_PROG_OBJBRIDGE">
<field-descriptor name="programId" column="PROGRAM_ID"
jdbc-type="BIGINT" primarykey="true"/>
<field-descriptor name="objId" column="OBJ_ID" jdbc-type="BIGINT"
primarykey="true"/>
<reference-descriptor
name="objective"
class-ref="appian.fhysp.beans.ObjectiveBean"
auto-update="false">
<foreignkey field-ref="objId"/>
</reference-descriptor> </class-descriptor>
ProgramBean's contain a proxy collection ProgObjBridgeBeans which hold a programs relationship to an objective. When I access the ProgObjBridgeBeans collection, the objective field SHOULD be filled from the database with the ObjectiveBean id, title, and descr. Instead, OJB is correctly retrieving the title, but seems to be overwriting the id. (See SQLSpy Output below for more information).
SQLSpy Output:
1083076041971|0|0|statement|SELECT A0.TITLE,A0.DESCR,A0.GOAL_ID,A0.OBJECTIVE,A0. ID FROM FP_OBJECTIVE A0 WHERE A0.ID IN ( ? )|SELECT A0.TITLE,A0.DESCR,A0.GOAL_ID ,A0.OBJECTIVE,A0.ID FROM FP_OBJECTIVE A0 WHERE A0.ID IN ( '0' ) 1083076042041|10|1|statement|SELECT A0.VERSION,A0.GRAB_SIZE,A0.MAX_KEY,A0.FIELDN AME,A0.TABLENAME FROM OJB_HL_SEQ A0 WHERE (A0.TABLENAME LIKE ? ) AND A0.FIELDNA ME LIKE ? |SELECT A0.VERSION,A0.GRAB_SIZE,A0.MAX_KEY,A0.FIELDNAME,A0.TABLENAME FROM OJB_HL_SEQ A0 WHERE (A0.TABLENAME LIKE 'SEQ_FP_OBJECTIVE' ) AND A0.FIELDNA ME LIKE 'ID' 1083076042061|10|1|statement|SELECT VERSION,GRAB_SIZE,MAX_KEY,FIELDNAME,TABLENAM E FROM OJB_HL_SEQ WHERE TABLENAME = ? AND FIELDNAME = ? |SELECT VERSION,GRAB_SI ZE,MAX_KEY,FIELDNAME,TABLENAME FROM OJB_HL_SEQ WHERE TABLENAME = 'SEQ_FP_OBJECTI VE' AND FIELDNAME = 'ID' 1083076042071|0|1|statement|UPDATE OJB_HL_SEQ SET MAX_KEY=?,GRAB_SIZE=?,VERSION= ? WHERE TABLENAME = ? AND FIELDNAME = ? AND VERSION = ? |UPDATE OJB_HL_SEQ SET MAX_KEY='352',GRAB_SIZE='20',VERSION='16' WHERE TABLENAME = 'SEQ_FP_OBJECTIVE' AND FIELDNAME = 'ID' AND VERSION = '15' 1083076042071|0|1|commit||
Note that after it retrieves the information from FP_OBJECTIVE (filling out the proxy collection of ProgObjBridgeBeans), it then makes a call to the primary key auto-incrementer, and the id of the retrieved ObjectiveBean is set to MAX_KEY +1;
Any ideas?
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
