Jump to content

Talk:Jakarta Persistence Query Language

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Uzume (talk | contribs) at 23:19, 30 July 2020 (Uzume moved page Talk:Java Persistence Query Language to Talk:Jakarta Persistence Query Language: Oracle donates all of Java EE to Eclipse and they are forced to rename everything away from "Java" trademark so now this is Jakarta Persistence Query Language, a part of Eclipse EE4J). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
WikiProject iconJava Stub‑class Low‑importance
WikiProject iconThis article is within the scope of WikiProject Java, a collaborative effort to improve the coverage of Java on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
StubThis article has been rated as Stub-class on Wikipedia's content assessment scale.
LowThis article has been rated as Low-importance on the project's importance scale.

Mistake in example?

This article currently has the following example:

import javax.persistence.EntityManager;
import javax.persistence.Query;
import org.apache.commons.lang.StringUtils;

...

@SuppressWarnings("unchecked")
public List<Author> getAuthorsByLastName(String lastName) {
    String queryString = "SELECT a FROM Author a " +
                         "WHERE :lastName IS NULL OR LOWER(a.lastName) = :lastName";
    Query query = getEntityManager().createQuery(queryString);
    
    query.setParameter("lastName", StringUtils.lowerCase(lastName));
    return query.getResultList();
}

(Keep in mind the Author class has a field private String firstName.)

The WHERE :lastName IS NULL part doesn't make sense to me. Shouldn't it be written WHERE lastName IS NULL (i.e., without the colon)? In case I'm wrong, can someone please explain the semantics of this query? --Abdull (talk) 15:20, 29 September 2012 (UTC)[reply]

What is Author in the first query string?

Anyone just reading this page will be immediately close the page because it's not at all clear what is Author in the first query? I guess it's a class which has been shown before, so making a link to the source code makes reading this article much less annoying, maybe even pleasant... 92.195.55.224 (talk) 18:47, 1 December 2012 (UTC)[reply]


Seems like it's because of a vandalism by the following entries: (cur | prev) 09:39, 9 October 2012‎ 183.82.123.104 (talk)‎ . . (3,549 bytes) (-220)‎ . . (→‎Examples) (undo) (cur | prev) 09:38, 9 October 2012‎ 183.82.123.104 (talk)‎ . . (3,769 bytes) (-300)‎ . . (→‎Examples) (undo)

Someone with more knowledge please fix it. 174.61.157.234 (talk) 07:20, 12 December 2012 (UTC)[reply]