Hi,
I'm giving OJB my first try and found a problem which I believe to be
probably my mistake.
I have a 1:n association between Job_specification and Job_type.
When I retrieve a spec, the aJob_type field has a null value. I debugged and
saw that method ObjectReferenceDescriptor.getForeignKeyFieldDescriptors()
works fine. The problem seems to be in the method
ClassDescriptor.getFieldDescriptorByIndex(int index). Its implementation
returns the descriptor at position (index - 1), instead of index. When I
change this implementation to return m_FieldDescriptions[index], everything
works fine.
Since this is probably a very common and recurrent scenario, I think the
problem is with my configuration (see repository.xml below). Or is this
really a bug?
Any help would be appreciated.
Thanks,
Ricardo.
PS.: I could not find anything related to this in the ojb mailing lists
archives.
--------------------
My repository.xml states the following:
<class-descriptor
class="uol.job.store.Job_specification"
table="JOB_SCHEDULER.JOB_SPECIFICATION">
<field-descriptor id="0"
name="iDT_JOB_SPECIFICATION"
column="IDT_JOB_SPECIFICATION"
jdbc-type="BIGINT"
primarykey="true"
/>
<field-descriptor id="1"
name="iDT_JOB_TYPE"
column="IDT_JOB_TYPE"
jdbc-type="BIGINT"
/>
...
<reference-descriptor
name="aJob_type"
class-ref="uol.job.store.Job_type">
<foreignkey field-id-ref="1"/>
</reference-descriptor>
</class-descriptor>
<class-descriptor
class="uol.job.store.Job_type"
table="JOB_SCHEDULER.JOB_TYPE">
<field-descriptor id="0"
name="iDT_JOB_TYPE"
column="IDT_JOB_TYPE"
jdbc-type="BIGINT"
primarykey="true"
/>
<field-descriptor id="1"
name="dES_JOB_TYPE"
column="DES_JOB_TYPE"
jdbc-type="VARCHAR"
/>
</class-descriptor>
My Job_specification class is defined as:
public class Job_specification
{
private Long iDT_JOB_SPECIFICATION;
private Long iDT_JOB_TYPE;
private Job_type aJob_type;
...
public Long getIDT_JOB_SPECIFICATION()
{
return this.iDT_JOB_SPECIFICATION;
}
public void setIDT_JOB_SPECIFICATION(Long param)
{
this.iDT_JOB_SPECIFICATION = param;
}
public Long getIDT_JOB_TYPE()
{
return this.iDT_JOB_TYPE;
}
public void setIDT_JOB_TYPE(Long param)
{
this.iDT_JOB_TYPE = param;
}
public Job_type getAJob_type()
{
return this.aJob_type;
}
public void setAJob_type(Job_type param)
{
this.aJob_type = param;
}
...
}