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
0
votes
3 answers

Named query not known: findById

I'm trying to build this simple project but I keep getting the same error. Can anybody help figure this out? HibernateTest.java public class HibernateTest { public static void main(String[] args) { SessionFactory sessionFactory =…
Jurgen Malinao
  • 149
  • 1
  • 1
  • 5
0
votes
2 answers

How to force Hibernate to use left outer join on a component for a named query?

I try to force Hibernate to use a left outer join for my namedQuery. Unfortunatally it always generates aditionally an inner join, despite me explicitly telling him to use a left outer join. My named query:
0
votes
1 answer

grails named queries giving null when using get() in unit test

I have a domain with named query: class Publication { String title String author static namedQueries = { publicationsWithBookInTitle { like 'title', '%Book%' } } @Override String toString() { …
MKB
  • 7,587
  • 9
  • 45
  • 71
0
votes
0 answers

NamedQuery format

I get an error when using the following named query, am I doing something wrong. @NamedQuery(name = "TblStationActionCodes.findNextByStationName", query = "SELECT t FROM TblStationActionCodes t, TblStationStations t1 WHERE t1.stationName =…
Duncan Groenewald
  • 8,496
  • 6
  • 41
  • 76
0
votes
1 answer

Named query to join 2 tables from another table

I am working on a Java EE project using hibernate, I am facing a class diagram similar to this one: What I want to get is a list of customers who ordered a product. That means my named query has to get ID of the wanted product, and I want my named…
elmetni hamza
  • 221
  • 1
  • 12
0
votes
3 answers

In an SQL statement, how do you select all elements that are NOT a certain condition?

I'm sorry I formulated the question so badly--I'm new to programming. What I'm doing is, I'm using Java @NamedQuery in a little Library manager application. I have the entity class Book with attributes bookid, title, author, etc. and Bookstaken with…
0
votes
1 answer

JPA: How to combine a @NamedStoredProcedureQuery with a @NamedQuery to perform a perimeter search?

I have some entities B and C inheriting from a parent entity A. Hence, I have a joined, multiple inheritance structure in my database. Furthermore, I have defined some @NamedQueries on these entitites which work well. I intend to have a…
du-it
  • 2,561
  • 8
  • 42
  • 80
0
votes
2 answers

Usage of Hibernate Mapping Xml when parameter name changed

I am using session.getNamedQuery("query1").setString("a", "123") session.getNamedQuery("query2").setString("b", "123") session.getNamedQuery("query3").setString("c", "123") to set parameter. select * from table…
maskapsiz
  • 244
  • 5
  • 23
0
votes
1 answer

Finding an inherited entity over a jointable with NamedQuery

How can I use a NamedQuery to find an entity over a jointable? I have an abstract parent class/entity with @Inheritance(strategy=InheritanceType.JOINED) and two subclasses/subentities. Hence, in the database I have a parent table (sdrs) and two…
du-it
  • 2,561
  • 8
  • 42
  • 80
0
votes
1 answer

SSAS Named Query Key Column

I am fairly new to SSAS and I have tried to find out the answer to this question but have had no luck. I have a data source view with multiple tables and their relationships defined. However what I want to return to my application are values from…
Idea Man
  • 85
  • 1
  • 6
0
votes
1 answer

@OneToMany relationship property not filled

I have implemented Joined, Multiple Table Inheritance. There is a 'parent' table pois and two sub tables: xPois and yPois and in turn I have an abstract PoiDao class as well as a XPoiDao and a YPoiDao class extending PoiDao. A poi may have multiple…
du-it
  • 2,561
  • 8
  • 42
  • 80
0
votes
2 answers

JPA: TypedQuery gets no results for inherited types

I have an entity which extends another entity: @Entity @DiscriminatorValue("PARKING") @Table(name="parkingPois") @NamedQueries({ @NamedQuery(name="ParkingPoiDao.findAll", query="SELECT p FROM ParkingPoiDao p"), …
du-it
  • 2,561
  • 8
  • 42
  • 80
0
votes
2 answers

Jpa named query: how to get a list of column

I have an entity orderdetails, where a user can have many ordernames I want to get all the ordername by userid using jpa named query. I tried this SELECT o.orderName FROM OrderDetails o WHERE o.userId=:userId; Since the return type will be List…
Maverick
  • 1
  • 3
0
votes
1 answer

JSP dont show values correctly from Database

In mi web application i have a combo with options including the more than or less than symbols. When you open the combo looks ok, but when you select it look wrong (pic 1). Only i want to show both correctly, when you open the combo and when you…
S. Moreno
  • 526
  • 2
  • 7
  • 29
0
votes
2 answers

jpql (NamedQuery) subquery not working with parameter

I'm using JPQL and a NamedQuery to query the database in a combined question. @NamedQuery(name = "Entry.findAllForName", query = "Select p From Entry p Where p.entryId In(Select dp.entry From EntryPart dp Where dp.part IN(Select d From Part d Where…
Hiny
  • 195
  • 7
  • 21