• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Why is my CrudRepository<T,Long>, QuerydslPredicateExecutor<T> interface do not generate the Bean ?

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everybody,

I'm trying to understand how I must configurate my application for using a CrudRepository<T,Long>, QuerydslPredicateExecutor<T> Interface to create a Bean and the implementation class on the run time.

I'm using Java 10 with Spring JPA, Hibernate, Spring MVC and an Oracle 11G XE Database.  I had no problems when I was mapping actual tables.  It was very easy, but I wanted to use QueryDSL mapped on a view instead of a table.  I've seen many example on the web where the writers simply just create the CrudRepository<T,Long>, QuerydslPredicateExecutor<T> interface and inject it in an object with the @Autowired annotation.  Those examples are working very well, but the configuration is totally different from my application's configuration.  I want to do the same, but for a reason I do not understand, I'm getting only errors on the run time saying they can't find the qualified Bean name for my private attribute of type that is implementing CrudRepository<T,Long>, QuerydslPredicateExecutor<T>;





Thank you !

 
Leinad Nongag
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator







This is my pom
 
Leinad Nongag
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is my spring-servlet config :



I tried to send more files but it seems I can't upload zip files  
 
Rancher
Posts: 499
6
IntelliJ IDE Spring Fedora
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How did you extend two things? I thought you can only extend one class.  
 
Leinad Nongag
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's because they are Interfaces and not Classes.  Most of the examples I've seen does the same thing.  You extend your intertface with CrudRepository<T,O> for implementing the basic database commands and then, the QuerydlsPredicateExecutor<T> for genarating the  type safe query API.

After that, you can generate Q[your_query_name] object that you can use to create your own query :



It's very useful !
 
Al Hobbs
Rancher
Posts: 499
6
IntelliJ IDE Spring Fedora
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe because you are extending two interfaces, spring isn't able to make the instance.
 
Al Hobbs
Rancher
Posts: 499
6
IntelliJ IDE Spring Fedora
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay I think your problem lies with the @norepositorybean
docs.spring.io/spring-data/commons/docs/current/api/org/springframework/data/repository/NoRepositoryBean.html
That annotation makes it so spring doesn't create an instance. Maybe you need it to use the querydsl interface.  You might have to create the bean yourself if you are using that annotation.
 
Al Hobbs
Rancher
Posts: 499
6
IntelliJ IDE Spring Fedora
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You might be able to just use @repository
 
Leinad Nongag
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you All Hobbs, I will try to use @Repository.  I've seen examples where it wasn't used, or other with the @NoRepositoryBean, but no of those example were complete.
 
Leinad Nongag
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everybody,

it seems the @Repository options isn't working, I still get those bean errors.

But this time I build the Configuration in Java class.  But yet, I have problems with my Validator Bean and my CrudRepository<T,Long>, QuerydslPredicateExecutor<T>.

Maybe those two plugins doesn't work well together, ILl have to stick to my services.
 
Aaaaaand ... we're on the march. Stylin. Get with it tiny ad.
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!