spring data jpa - How to have a @Query with a possibly null parameter -


I have a @Query that gives me the problem I want to get all the webpages Those who have a given parent, even if given given parents father.

Parents can be set but it can not be set too.

I is trying this:

  @Query ("Choose from wp = wp = parent: parent (or parent: parent.id & lt; '1')) order by w.listOrder ") public page & lt; Webpage & gt; FindByParent (@Param ("parent") webpage parents, page creation page);  

and this:

  @Query ("Select from the webpage where w.parent =: the parent (or the guardian is parent and the parent) )) Order by w.listOrder ") public page & lt; Webpage & gt; FindByParent (@Param ("parent") webpage parents, page creation page);  

But I get an exception:

  By: java.lang.IllegalArgumentException: The method failed to validate the query for the public abstract. Com. Thalasoft.learnintouch Data.jpa.domain.Webpage com.thalasoft.learnintouch.data.jpa.repository.WebpageRepository.findByParentAndNameAndGarbage (com.thalasoft.learnintouch.data.jpa.domain.Webpage, java.lang.String)!  

I am using spring 3.2.9 .RELEASE and spring-data-JPA 1.6.1 .RELEASE version.

How can I choose but any thoughts given to a given parent, even if my parents tap?

Type of relationship,

Stephen Ibr

if Verification on the provider will not allow you to pass through the tap, you can divide the query into two.

Query1 (not the ultimate faucet): To call you for the @Query ("SELECT w FROM)" you must have the log in the caller.WebPage y WHERE w .parent =: w.listOrder "by parent ORDER") public page & lt; Webpage & gt; FindByParent (@Param ("parent") webpage parents, page creation page);

Question 2 (the ultimate one is out):

  @Query (choose "w parent null command w.listOrder" from the webpage w) public page & lt ; Webpage & gt; FindByNullParent (page creation page);  

I recommend reading some more documents on my provider how to enter the tap.


Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -