load metodu
Şöyle yaparız.
Şöyle yaparız.
public AddressKeyEntity getAddressKeyEntity(AddressKeyEntity addressKey) {
AddressKeyEntity item = session.byNaturalId(AddressKeyEntity.class)
.using("address", addressKey.getAddress())
.using("city", addressKey.getCity())
.using("state", addressKey.getState())
.using("zip", addressKey.getZip())
.with(LockOptions.UPGRADE.setTimeOut(LockOptions.WAIT_FOREVER))
.load();
if(item != null) {
return item;
} else {
sessionFactory.getCurrentSession().persist(addressKey);
return addressKey;
}
}
Hiç yorum yok:
Yorum Gönder