I have the following query:
Map<BusinessRecord, List<BusinessAddressRecord>> resultMap = dslContext
.select()
.from(BUSINESS.leftJoin(BUSINESS_ADDRESS).on(BUSINESS.ID.eq(BUSINESS_ADDRESS.BUSINESS_ID)))
.where(BUSINESS.IDENTIFIER.equal(identifier))
.and(BUSINESS_ADDRESS.DEACTIVATED_AT.isNull())
.fetchGroups(
b -> b.into(BUSINESS),
a -> a.into(BUSINESS_ADDRESS)
);
Unfortunately this returns null if a business has no address listed, I managed to resolve this by doing:
Map<BusinessRecord, List<BusinessAddressRecord>> resultMap = dslContext
.select()
.from(BUSINESS.leftJoin(BUSINESS_ADDRESS).on(
BUSINESS.ID.eq(BUSINESS_ADDRESS.BUSINESS_ID).and(BUSINESS_ADDRESS.DEACTIVATED_AT.equals(null))
))
.where(BUSINESS.IDENTIFIER.equal(identifier))
.fetchGroups(
b -> b.into(BUSINESS),
a -> a.into(BUSINESS_ADDRESS)
);
But this is saying the 'and' in
and(BUSINESS_ADDRESS.DEACTIVATED_AT.equals(null))
is deprecated, what is the alternative?