Path: csiph.com!news.swapon.de!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Cecil Westerhof Newsgroups: comp.lang.java.programmer Subject: Re: Using GROUP By or @OrderColumn in JPA Date: Thu, 26 Nov 2015 07:28:20 +0100 Organization: Decebal Computing Lines: 32 Message-ID: <87two9e0l7.fsf@Equus.decebal.nl> References: <87bnai8pu7.fsf@Equus.decebal.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: mx02.eternal-september.org; posting-host="528adfd6ad074c92fdc6a7f8fb9e23d8"; logging-data="24793"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX189FlcbdYcl2fsMVJROcsNe5BsJlx3ckGE=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) Cancel-Lock: sha1:yYn5b0f7obtcZDXIRsBqsn1Ucdk= sha1:uVwWpyRChOYYGU6Xn+Hdhjz9pfU= X-Homepage: http://www.decebal.nl/ Xref: csiph.com comp.lang.java.programmer:33206 On Thursday 26 Nov 2015 02:02 CET, Arne Vajhøj wrote: > On 11/25/2015 3:07 AM, Cecil Westerhof wrote: >> We are working on our first project with JPA. We had some bumps in >> the road, but I find it a good tool. >> >> We have an entity request which has a one to many relationship with >> estimate which has a one to one relationship with decision. One of >> the fields of decision is date. >> >> We need request-estimate-decision's where the date field of >> decision is not null and has the highest value. (We are only >> interested in the latest decision pro request.) >> >> I was thinking about a GROUP BY, but someone else thought about >> @OrderColumn. But if I understand it correctly an @OrderColumn >> needs an Integer and an index. We cannot change the database >> definition. So I suppose that @OrderColumn is not an option and we >> need to use the GROUP BY? > > How did you do it before with SQL? This was never done with SQL. They made a JPQL query that was badly written. I managed to help rewrite it, so it is a bit clearer what is happening. But everything was done over instant message, which is not ideal. Today we will meet face to face and I hope to get a better understanding of what they want and have. -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof