Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.help > #1023

Re: CriteriaQuery and JPA

Date Thu, 08 Sep 2011 09:48:36 +0200
From Lele <lele@lele.com>
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0.2) Gecko/20110902 Thunderbird/6.0.2
MIME-Version 1.0
Newsgroups comp.lang.java.help
Subject Re: CriteriaQuery and JPA
References <4e676e7b$1@news.x-privat.org> <fcd93a94-1fe2-42ee-aa7d-545df845d5c1@glegroupsg2000goo.googlegroups.com>
In-Reply-To <fcd93a94-1fe2-42ee-aa7d-545df845d5c1@glegroupsg2000goo.googlegroups.com>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
NNTP-Posting-Host $$afwhll$slnyo.news.x-privat.org
Message-ID <4e687355$2@news.x-privat.org> (permalink)
Organization X-Privat.Org NNTP Server - http://www.x-privat.org
Lines 26
X-Authenticated-User $$p9zou1n1$ng5dhdq$s2
X-Complaints-To abuse@x-privat.org
Path csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!feeder.news-service.com!news2.euro.net!newsfeed.x-privat.org!x-privat.org!not-for-mail
Xref x330-a1.tempe.blueboxinc.net comp.lang.java.help:1023

Show key headers only | View raw


Il 07/09/2011 20:02, Lew ha scritto:

> Read the Javadocs for 'Root#get(String attributeName)'.  You gave a 'null' attribute name, and what you tried to do wasn't giving an attribute *name*, but an attribute *value*.

Ok, I try to remake my question.
My class has a field named 'username':

public MyClass{
     public String username;
}

I have to create a where clause that check if this field is equal to a 
constant value:
WHERE username = "test"

I understand that Root#get(String attributeName) give to me the 
attribute name (and not the attribute value), so how can i put a 
constant value inside the clause?

filter.where(criteriaBuilder.equal(from.get("username"),"test"));

with this code i would expect a where clause like the above. Instead i 
have the null value : WHERE username = ?

Sorry but I'm new to JPA

Back to comp.lang.java.help | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

CriteriaQuery and JPA Lele <lamia@mail.lcom> - 2011-09-07 15:15 +0200
  Re: CriteriaQuery and JPA Lew <lewbloch@gmail.com> - 2011-09-07 11:02 -0700
    Re: CriteriaQuery and JPA Lele <lele@lele.com> - 2011-09-08 09:48 +0200
    Re: CriteriaQuery and JPA Lele <lelel@lele.com> - 2011-09-08 15:03 +0200
      Re: CriteriaQuery and JPA markspace <-@.> - 2011-09-08 06:39 -0700
        Re: CriteriaQuery and JPA Lele <lelel@lele.com> - 2011-09-08 16:53 +0200
          Re: CriteriaQuery and JPA Lew <lewbloch@gmail.com> - 2011-09-08 09:05 -0700

csiph-web