jeudi 20 septembre 2018

Db Unit does not get the data in the data set

Get data from ManyToOne relation is failing.

Consider two entitiesJob and BusinessObject. There is a ManyToOne relation between Job and BusinessObject as follow:

public class Job {

    BusinessObject target;

    @ManyToOne
    @JoinColumn(name = "target_id")
    public BusinessObject getTarget() {
        return target;
    }
}

I created a data set as:

<jobs id="5"
      version="1"
      created="2007-10-31 07:45:00"
      type_id="1"
      state="open"
      description="Testityö #10."
      business_unit_id="1"
      target_id="1"
      delivery_address_name="[NULL]"
      delivery_address_line="Kuja 1"
      delivery_address_zip_code_id="3"/>

<business_objects id="1"
                  version="1"
                  created="2010-03-11"
                  customer_id="1"
                  key="100"/>

In the test when I get job via service jobService.getJob(5) the target is null. I get the businessObject businessObjectService.getBusinessObject(1) and it can be found.

Aucun commentaire:

Enregistrer un commentaire