Questions tagged [named-query]

A Hibernate (and NHibernate) feature that allows for both HQL and SQL queries to be written in the mapping document, keyed by a name. The main advantage is that your query is now residing in the same place as the definition of your mappings, instead of in your Java/C#/VB.NET/... code.

521 questions
1
vote
0 answers

jBPM 5.2, getProcessInstancesWaitingForEvent method

Looking at the class JpaProcessPersistenceContext I noticed this method getProcessInstancesWaitingForEvent which uses this named query ProcessInstancesWaitingForEvent. The aforementioned method should be used by the JPASignalManager to cache the…
Marius
  • 11
  • 2
1
vote
1 answer

case statement with group by in jpa named query giving syntax error?

We are getting syntax error in group by clause while using group by with case statement in JPA named queries. We are using openjpa. Query looks like this(ids is a list in mentioned query) select r.city,case when r.name='test' then 'T' else 'N' end…
alok
  • 11
  • 4
1
vote
1 answer

Named query for entity that does not associate with a specific table

I'm using Quarkus and Hibernate / Panache. For this example, I have 3 tables (table_a, table_b, table_c) that I am joining together using a native query. In the project I'm working on, it's around 5 JOIN tables to retrieve the information I'm…
user0000001
  • 2,092
  • 2
  • 20
  • 48
1
vote
1 answer

JPQL TypedQuery - setParamer does not work

I am trying to fetch an entity which has a one-to-one relation using a named Query. My "where" condition is on the relation entity. I am giving a named parameter. When I execute the query it ignores the parameter passed and giving me all the…
ssj
  • 60
  • 8
1
vote
1 answer

Hibernate complex query for more then two entity

I am trying to make hibernate query for searching and filtering my entity but I can't to find any solution. I have three bounded entities. group entity public class Group { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) …
1
vote
1 answer

How to write select named query in jpa for EmbeddedId?

I have a JPA entity called Parent and inside that there is embeddedPrimary key as Child @Entity @Table(name = "PARENT") @NamedQuery(?????) public class Parent implements Serializable { @EmbeddedId private ChildPK…
MiGo
  • 551
  • 2
  • 7
  • 17
1
vote
2 answers

Hibernate 5: using named query with stateless session returning java.lang.UnsupportedOperationException

after we upgrade our project from hibernate 4 to 5, we have been getting this exception where we are trying to get scrollable result from named query with stateless session. so far we have tried googling it and setting parameters but it seems like…
1
vote
2 answers

JBoss/Hibernate IllegalArgumentException: Named query not Found

I'm new to Java EE and having some trouble using named queries. We use JBoss 6 and Hibernate 3.6 (JPA 2.0). The entity is configured via annotations and not in the persistence.xml: @Entity @NamedQueries({ @NamedQuery(name = "Node.findRootNodes",…
1
vote
2 answers

Not Equals Query on Spring Boot REST/JPA Service

I'm brand new to Spring Boot, and I've created a very basic REST service that uses JPA, and exposes the RepositoryRestResource for CRUD and query operations on my model: @RepositoryRestResource public interface CatalogueOrderRepository extends…
robbieperry22
  • 1,753
  • 1
  • 18
  • 49
1
vote
1 answer

Using HashSet as argument in JPA NamedQuery throws IllegalArgumentException

I've set a NamedQuery like this: @Entity @Table(name = "channel") @NamedQuery(name = "Channel.getPrivateChannel", query = "SELECT pvt from Channel pvt WHERE pvt.state = 3 AND pvt.channelOwnerWorkspace = :channelOwnerWorkspace AND…
plmkr
  • 11
  • 2
1
vote
1 answer

JPA with Eclipselink is ignoring left outer join and add wrong FROM condition

I have a Menu entity that has a parent Menu: public class Menu implements Serializable { ... @JoinColumn(name = "parent" , nullable = true, referencedColumnName = "id") @ManyToOne(targetEntity = Menu.class,fetch = FetchType.EAGER, cascade =…
Daniele Licitra
  • 1,520
  • 21
  • 45
1
vote
1 answer

different result by executing query in console and namedQuery

in my java web application i need to inquire a list of deposits from a view named VwDepositsInfo by customerNumber. when i execute my query: select * from VW_DEPOSIT_INFO v where v.CUSTOMER_NUMBER=:customerNo in database console my resultList size…
Sobhan
  • 1,280
  • 1
  • 18
  • 31
1
vote
1 answer

How to read jpa named queries from application properties file in spring boot?

I have custom long sql queries strings in my JPA repository interface.I feel move this queries to some properties files because when i want execute queries against my DB i have to do remove all '+' plus sign and double quote's. Instead of remove…
1
vote
1 answer

Java jSF NamedQuery using an Int

I am making a search query for a integer. This is the NamedQuery in the class Factuur: @NamedQueries({ @NamedQuery(name = "getFactuurs", query = "SELECT f FROM Factuur f WHERE " + "f.periode LIKE :periode AND " + "f.carTracker.kenteken LIKE…
Tom
  • 11
  • 2
1
vote
2 answers

Hibernate namedquery throws ORA-00979: not a GROUP BY expression

I have a problem about getting the result from namedquery based on hibernate. Here are the namedqueries here. @NamedQuery(name = "DetailOrder.bestSelling", query = "SELECT do.book FROM DetailOrder do GROUP BY do.book.id " +…
S.N
  • 2,157
  • 3
  • 29
  • 78