question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SpringJPA: @Query(nativeQuery) support

See original GitHub issue

Description The current spring-data-jpa module (1.0.0.CR1) doesn’t support the ‘nativeQuery’ attribute of org.springframework.data.jpa.repository.Query

@geoand WDYT ?

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:7
  • Comments:28 (17 by maintainers)

github_iconTop GitHub Comments

4reactions
geoandcommented, Feb 4, 2022

There isn’t anything in the documentation that I am aware of, but you could certainly do something like this:

@ApplicationScoped
public class FruitRepository implements PanacheRepository<Fruit> {

    private final EntityManager entityManager;

    public FruitRepository(EntityManager entityManager) {
        this.entityManager = entityManager;
    }
    
    public List<Fruit> nativeQuery() {
        return entityManager.createNativeQuery("select * from fruits where name = 'test'", Fruit.class).getResultList();
    }
}
2reactions
fluoxacommented, Jun 5, 2020

Hello Guys. What is the status of this feature request. Are there any plans to implement nativequery support? regards

Read more comments on GitHub >

github_iconTop Results From Across the Web

Native Queries with Spring Data JPA - Thorben Janssen
Native queries are the most powerful and flexible way to implement your read operations. They enable you to use all features supported by...
Read more >
Spring Data JPA @Query - Baeldung
In this tutorial, we'll demonstrate how to use the @Query annotation in Spring Data JPA to execute both JPQL and native SQL queries....
Read more >
JPA Native Query example with Spring Boot - BezKoder
Spring JPA supports both JPQL and Native Query. ... JPQL is inspired by SQL, and its queries resemble SQL queries in syntax, but...
Read more >
Spring Data JPA - Reference Documentation
Spring Data JPA provides repository support for the Jakarta Persistence API ... “Repository query keywords” covers the query method keywords ...
Read more >
Spring Boot JPA - Native Query - Tutorialspoint
Spring Boot JPA - Native Query, Some time case arises, where we need a custom native query to fulfil one test case. We...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found