unique « Query « JPA Q&A





1. Hibernate, select by id or unique column    stackoverflow.com

I am using hibernate for Java, and I want to be able to select users by id or by name from the database. Nice thing about Hibernate is that it caches ...

2. Selecting unique logins in a given time period    stackoverflow.com

My SQL is a little rusty and JPQL is entirely new to me. I have a table with recorded login events, which have a user id and a time. I'm trying ...

3. Hibernate(HQL) - how to find the unique query from many to many tables?    stackoverflow.com

public class Menu { 
  private int menuId; 
  private String name;
  private Set<Item> items=new HashSet<Item>(); 

} 
public class Item { 
  private int itemId; 
  ...

4. Hibernate: how to get unique order numbers?    coderanch.com

Here's my requirement: my web application needs to generate unique confirmation numbers for its order entry application. The numbers have to be between 1 and 99999 and generally should be sequential, although if there are gaps in the sequence that doesn't really matter. Eventually the number sequence will wrap around, which is okay, but giving out the same number to two ...

5. HQL - using distinct , unique functions of oracle.    forum.hibernate.org

I would like to retrieve the data in sub query which returns current employees of organisation entity. Main query selects only those persons are present in sub query. main query : select * from baseEntity where employee in (select employee from organistion which is current); here i wanted to introduce unique(employee) in sub query. How to acheive this ?

6. Noob question - doing a "SELECT UNIQUE"?    forum.hibernate.org

7. Unique object instance for query result    forum.hibernate.org

Hello, I'm new to hibernate and I'm not sure how to change the following behavior. When I run a query and get the unique result I get the same instance each time the query is called. For example, Criteria criteria=Session.createCriteria(Person.class); criteria.add(Restriction.eq("Id",1)); Person p=criteria.uniqueResult(); System.out.println(p.getName()+" "p.toString()); generates John Smith Person@f961d5 At another point in the application I perform the same query and ...

8. Article or help on doing "select unique..." with H    forum.hibernate.org

I've searched the hibernate.org site and done some googling for info, but haven't found anything useful yet. I'm trying to do a basic "select unique myProperty from myEntity" in HQL but am not having any luck. I got unexpected token errors with that form, which I can get past if I do it as "select unique(myProperty) from myEntity". However, that form ...

9. Why is count(*) not returing unique Result    forum.hibernate.org

Hi, I am wondering why the following: Query countQuery = getSession().createQuery("select count(*) from Product where companyId = 1"); Integer datasetSize = (Integer) countQuery.uniqueResult(); throws a NonUniqueResultException. I did a countQuery.list(), and found that the query returns a list of 2 elements. The first is the count result, and the second is a zero Integer. I am using Hibernate 3.1.2. Many thanks ...





10. Query question about pulling out unique values    forum.hibernate.org

I hava a table with a column called description. An ajax drop down runs the query, allowing users autocompletion for descriptions they have previously entered. The problem I'm having is eliminating duplicate descriptions from the query. For example, if I had 300 rows with the description "computer", I only want to display "computer" once. I can think of some hacky ways ...

11. Query View (no unique key)    forum.hibernate.org

Hibernate version: 3.2.2 Name and version of the database you are using: Oracle 10g I've an Oracle view with 6 columns: name, id, company, department, reference, creationdate. I used all the columns (some columns are nullable) as the composite-id. Is it ok to have nullable fields in composite-id or all fields in composite-id must be not-null? In the view, there's a ...

12. Selecting Unique Results    forum.hibernate.org

14. need unique result in hql subselect ("select top"    forum.hibernate.org

Hello. Have the following issue: Lets say I have 2 persistent classes: public class Item { public Long id; public String name; public List remarks; } public class Remark { public Long id; public String text; public Date creationDate; public Item item; } To query for item names and last item remarks I am using following hql query: select item.name, (select ...

15. Querying unique records along with object creation    forum.hibernate.org

Hi, I am trying to write a HQL which fetches data and also constructs the result object as follows: select new com.test.ResultDTO(c.countryid, c.countryname) from Country c I need to get all unique countrynames. I tried the following select new com.test.ResultDTO(c.countryid, distinct(c.countryname)) from Country c select new com.test.ResultDTO(c.countryid, unieuq(c.countryname)) from Country c but none seems to work. Can any one let me ...

16. Query cache exception with result unique and with colum uniq    forum.hibernate.org

Newbie Joined: Sat Jun 06, 2009 1:15 pm Posts: 4 Hello guys: I need your help, I have the following configuration in hibernate: Code: hibernate.show_sql=false hibernate.format_sql=true hibernate.jdbc.batch_size=100 hibernate.cache.use_second_level_cache=true hibernate.cache.use_query_cache=true hibernate.default_batch_fetch_size=100 hibernate.order_inserts=true hibernate.order_updates=true hibernate.cache.region_prefix=hibernate.cached and I am using the following libraries;: Hibernate 3.3.1.GA Spring 2.2 Strut 2 Then, I have a sql statement that returns one row and one column. It's knewn ...