79805156

Date: 2025-10-30 19:43:30
Score: 0.5
Natty:
Report link

Have you tried notExists() instead of id.eq(JPAExpressions.select(...).limit(1)) ?

jpaQueryFactory
    .selectFrom(qVehicleLocation)
    .innerJoin(qVehicleLocation.vehicle).fetchJoin()
    .where(
        JPAExpressions.selectOne()
            .from(subLocation)
            .where(
                subLocation.vehicle.eq(qVehicleLocation.vehicle),
                subLocation.createdAt.gt(qVehicleLocation.createdAt)
                .or(
                    subLocation.createdAt.eq(qVehicleLocation.createdAt)
                    .and(subLocation.id.gt(qVehicleLocation.id)) 
                )
            )
            .notExists()
    )
    .fetch();
Reasons:
  • Whitelisted phrase (-1): Have you tried
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Ends in question mark (2):
  • Low reputation (0.5):
Posted by: Max