Is it possible to join only first row (or just any other row but only one) using hql?
select
config.id, mg.modelGroupName, min(deliveryType.id)
from
NotificationConfig config, NotificationConfigEntry configEntry, SettlementModelGroup mg
join
configEntry.notificationConfigEntryPK.user user
join
configEntry.notificationConfigEntryPK.deliveryType deliveryType
join
config.notificationType notifType
join
notifType.objectType objectType
where
config.id = configEntry.notificationConfigEntryPK.notificationConfig.id
and ( mg.modelId = config.objectId or config.objectId is null )
This is the code i'm having right now, of course
min(deliveryType.id)
doesn't work. Relation between mg.modelId and config.objectId is not mapped, and deliveryType is a list. I can't use distinct cause I need to be able to order by deliveryType (this won't make any sense, but i need to make it anyway) and modelGroupName.
select config.id, mg.modelGroupName, deliveryType.id from NotificationConfig config, NotificationConfigEntry configEntry, SettlementModelGroup mg join configEntry.notificationConfigEntryPK.user user join configEntry.notificationConfigEntryPK.deliveryType deliveryType with deliveryType.id = (select min(id) from configEntry.notificationConfigEntryPK.deliveryType) ...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With