# Unable to guess FieldBridge for order in org.openmrs.Order

**URL:** <https://talk.openmrs.org/t/unable-to-guess-fieldbridge-for-order-in-org-openmrs-order/17925>\
**Category:** Development\
**Tags:** module, api, orders\
**Created:** [May 7, 2018, 1:43pm UTC](https://talk.openmrs.org/t/unable-to-guess-fieldbridge-for-order-in-org-openmrs-order/17925 "2018-05-07T13:43:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![owais.hussain](https://talk.openmrs.org/user_avatar/talk.openmrs.org/owais.hussain/32/530_2.png) [@owais.hussain](https://talk.openmrs.org/u/owais.hussain)\
**Post date:** [May 7, 2018, 1:43pm UTC](https://talk.openmrs.org/t/unable-to-guess-fieldbridge-for-order-in-org-openmrs-order/17925/1 "2018-05-07T13:43:29Z")

</div>

Hi devs,

I’m trying to write some unit tests for API of [this](https://github.com/seekme94/openmrs-module-commonlabtest) module. I’ve used Order entity as one-to-one identifying dependency in LabTest class.

On executing CommonLabTestServiceTest as JUnit, I’m thrown [this exception](https://pastebin.com/7dbb8MXr), I have no idea what FieldBridge is, and a quick SOF search indicates hibernate search version incompatibility; this is unlikely an issue since I’m using Openmrs defaults.

Any clues?

---

<div class="post-metadata">

**Author:** ![owais.hussain](https://talk.openmrs.org/user_avatar/talk.openmrs.org/owais.hussain/32/530_2.png) [@owais.hussain](https://talk.openmrs.org/u/owais.hussain)\
**Post date:** [May 8, 2018, 11:31am UTC](https://talk.openmrs.org/t/unable-to-guess-fieldbridge-for-order-in-org-openmrs-order/17925/2 "2018-05-08T11:31:24Z")

</div>

The issue was resolved by changing the way we define One-to-one mapping. Previously, I was trying to create mapping using:

```
public class LabTest extends BaseCustomizableData<LabTestAttribute> implements java.io.Serializable, Attributable<LabTest> {

@Id
@OneToOne(optional = false)
@JoinColumn(name = "test_order_id")
private Order order;
}

```

I changed to:

```
@Id
private Integer testOrderId;
@OneToOne(optional = false)
@PrimaryKeyJoinColumn(name = "testOrderId")
@JoinColumn(name = "test_order_id")
private Order order;

```

… by explicitly defining the primary key object. There’s a bug in earlier versions of hibernate 4.x, which tries to find a bridging entity for One-to-one mapping.

Thanks to @maimoonak for the tip.
