Hello,
I'm about 90% sure this problem started happening after I upgraded some stuff (OJB,
PostgreSQL and JDBC driver). What's happening is that for some reason, on inserting,
OJB seems to be inserting everything correctly except for my 'status_id' field and I
have no idea why. Below, I have a code sample, the SQL statement that is being
received by the database and repository defs. Notice that in the insert statement,
the status_id field is null despite being explicitly set by
newImport.setStatus_id("Q")...
Import newImport = new Import();
newImport.setUser_id(user.getId());
newImport.setFile_size(new BigDecimal(file.getFileSize()));
newImport.setIn_file(file.getFileName());
newImport.setOut_file(outFile.getName());
newImport.setStatus_id("Q");
try
{
tx = odmg.newTransaction();
tx.begin();
tx.lock(layerImport, tx.WRITE);
tx.commit();
}
..... the resulting SQL statement is....
INSERT INTO imports
(file_format,file_size,id,in_file,out_file,request_date,status_id,user_id) VALUES (
null, 3100237, 21, 'Exports.zip', '0001_60784.zip', null, null, 1 )
....Object Defs....
<class-descriptor class="Import" table="imports">
<field-descriptor id="1" name="file_format" column="file_format"
jdbc-type="VARCHAR"></field-descriptor>
<field-descriptor id="2" name="file_size" column="file_size"
jdbc-type="NUMERIC"></field-descriptor>
<field-descriptor id="3" name="id" column="id" jdbc-type="INTEGER" primarykey="true"
autoincrement="true"></field-descriptor>
<field-descriptor id="4" name="in_file" column="in_file"
jdbc-type="VARCHAR"></field-descriptor>
<field-descriptor id="5" name="out_file" column="out_file"
jdbc-type="VARCHAR"></field-descriptor>
<field-descriptor id="6" name="request_date" column="request_date"
jdbc-type="TIMESTAMP"></field-descriptor>
<field-descriptor id="7" name="status_id" column="status_id"
jdbc-type="VARCHAR"></field-descriptor>
<field-descriptor id="8" name="user_id" column="user_id"
jdbc-type="INTEGER"></field-descriptor>
<reference-descriptor name="lu_process_status" class-ref="Lu_process_status"
auto-retrieve="true" auto-update="false" auto-delete="false">
<foreignkey field-id-ref="7" />
</reference-descriptor>
</class-descriptor>
<class-descriptor class="Lu_process_status" table="lu_process_status">
<field-descriptor id="1" name="id" column="id" jdbc-type="VARCHAR"
primarykey="true"></field-descriptor>
<field-descriptor id="2" name="name" column="name"
jdbc-type="VARCHAR"></field-descriptor>
<collection-descriptor name="exports" element-class-ref="Export" auto-retrieve="true"
auto-update="false" auto-delete="false">
<inverse-foreignkey field-id-ref="9" />
</collection-descriptor>
<collection-descriptor name="imports" element-class-ref="Import" auto-retrieve="true"
auto-update="false" auto-delete="false">
<inverse-foreignkey field-id-ref="7" />
</collection-descriptor>
</class-descriptor>
-----------------------------------------------------------------------------------------
There's nothing wrong with my 'Import' bean. After setting the Status_id, I can
System.out.println(newImport.getStatus_id()) just fine.
I'm using OJB from CVS a few days ago (0.9.9+) and PostgreSQL 7.3.2 with their JDBC
7.3 driver.
Any ideas??
Thanks!
---------------------------------
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, and more