CriteriaBuilder cb = _entityManager.getCriteriaBuilder(); CriteriaQuery<Message> criteriaQuery = cb.createQuery(Message.class); Root<Message> messageRoot = criteriaQuery.from(Message.class); Root<Device> deviceRoot = criteriaQuery.from(Device.class); Fetch<Message, Device> recipientDeviceFetch = messageRoot.fetch("recipientDevice", JoinType.LEFT); Join<Message, Device> messageRecipientDeviceJoin = (Join<Message, Device>) recipientDeviceFetch; criteriaQuery.where(cb.and(messageRoot.get(Message.COLUMN_ID).in(messageIdsToDelete), cb.equal(deviceRoot.get(Device.COLUMN_PRIMARY_KEY), devicePrimaryKey))); criteriaQuery.select(cb.construct(Message.class, messageRoot.get("recipientDevice"), messageRoot.get(Message.COLUMN_CLIENT_MESSAGE_ID))); List<Message> messages = _entityManager.createQuery(criteriaQuery).getResultList(); return messages;
Anti Pattern: Its a pattern which we repeatedly do and which brings negative results. Architecture by implication: Systems lacking a clear and document architecture. Cover Your Assets: Continuing to document and present alternatives, without ever making an architectural decision. Witches Brew: Architectures made by groups resulting in a mix of ideas and lack a clear vision. Gold Plating: Continuing to define an architecture well pass the time which results in no benefits to the architecture. Vendor King: A product dependent architectures leading to a loss of control of architecture and development costs Big Bang Architecture: Designing the entire architecture at the beginning of the project when you know the least about the system.
Comments
Post a Comment