row « Query « JPA Q&A





1. How to get distinct results in hibernate with joins and row-based limiting (paging)?    stackoverflow.com

I'm trying to implement paging using row-based limiting (for example: setFirstResult(5) and setMaxResults(10)) on a Hibernate Criteria query that has joins to other tables. Understandably, data is getting cut off randomly; and ...

2. Inserting rows in table that has a relationship with another table    stackoverflow.com

In my database schema I have an entity that is identified. The identifier can be reused and thus there is a one-to-many relation with the entity. Example: A person can have ...

3. Get "surrounding" rows in NHibernate query    stackoverflow.com

I am looking for a way to retrieve the "surrounding" rows in a NHibernate query given a primary key and a sort order? E.g. I have a table with log entries and ...

4. How do we count rows using Hibernate?    stackoverflow.com

For example, if we have a table Books, how would we count total number of book records with hibernate? Thanks

5. Best way to write a named SQL query that returns if row exists?    stackoverflow.com

So I have this SQL query,

<named-query name="NQ::job_exists">
<query>
select 0 from dual where exists (select * from job_queue);
</query>
</named-query>
Which I plan to use like this:
Query q = em.createNamedQuery("NQ::job_exists");
       ...

6. Grails criteria projections - get rows count    stackoverflow.com

I have Hotel entity:

class Hotel {
City city
}
Now, i need count of hotels with given city. It could be done in this way:
def hotels = Hotel.findAllByCity(city)
def cnt = hotels.size()
But it's very dirty way. ...

7. Manipulating join table row ordering using Hibernate annotations    stackoverflow.com

I've done something similar to this with hbm files but so far I haven't found an equivalent using annotations. What I'd like to be able to do is create an ...

8. Most efficient way to count rows of a query    stackoverflow.com

I'm using Hibernate to retrieve the number of rows for a specific query. Let's say I have a table called 'Person' with various columns. One of those columns is ...

9. Multiple row update in nhibenrate    stackoverflow.com

So I was wondering whether it is best to update multiple rows in a database using an hql query or calling nhibernates save after modifying each object.. I know that the ...





10. Jpql selecting the one maximum row from each group    stackoverflow.com

I am relatively new to JPA and I would like to solve the following problem using jpql exclusively (note that the implementation I am using is Datanucleus): I have a table ...

11. JPA2 how to select n entities starting at the i'th entity/row    stackoverflow.com

I have let the modeling tools in my IDE create entities from tables, so each entity is one record. How can I select n records starting at the i'th record, such ...

12. How to select if a row exists in HQL    stackoverflow.com

EDIT: Specifically talking about querying against no table. Yes I can use exists, but I'd have to do

select case when exists (blah) then 1 else 0 end as conditionTrue
from ...

13. Select one column from a row in hibernate    stackoverflow.com

I am trying to do a simple query to get a unique result back in hibernate here is my code.

public String getName(Integer id) {
     Session session = ...

14. Hibernate: Find only those rows that aren't in a many-to-many relationship    stackoverflow.com

OK, I have mapped with annotations two tables with a bidirectional @ManyToMany relationship. Now I want to return only the elements which aren't in a many to many relationship, and I'm trying ...

15. Pagination with total row count in NHibernate    stackoverflow.com

I am trying to paginate a simple query using HQL, and retrieve the total row count as part of the same query. My query is simple enough...

var members = UnitOfWork.CurrentSession.CreateQuery(@"
   ...

16. Hibernate simple query but no rows returned    stackoverflow.com

The following query doesn't return any rows List remedies = session.createQuery("from Remedy").list(); No errors, but nothing in the remedies list and there are rows in the table. What I have is 2 tables: remedy ...





17. Hibernate Select Top and Bottom n Rows with Criteria    stackoverflow.com

Let's say I have two tables, Books and Reviews. Reviews has a column, stars, that can have a value between 1 and 5. A Book can have many Reviews. How would ...

18. Hibernate count rows with some criterias    stackoverflow.com

Suppose I have a table Person and i want to count all those people whose "birthDate" is not null and they are a student. Assuming i have two columns :

birthDate Date (can ...

19. Getting empty row on JPA query after creating    forums.netbeans.org

I'm learning java ee, so i made some modifications to the CRUD examples, now im getting some weird behavior, after creating a new row i go to list and for some reason that last row appears empty, i checked the result list of the query and its getting that row with null values. I do update the items on the bean ...

20. Rows count in hql    coderanch.com

I am trying to retrieve the number of rows returned with out retrieving the data, can anyone help me how to do this. I tried some thing like this select count(*) from table11 join.. where .... Usually select .. from ... returns a list but I need the result into an int variable which gives me the number of rows with ...

21. hibernate no row selected    coderanch.com

22. Hibernate Query Returns Duplicate Rows    coderanch.com

Okay. I have a weird question I was wondering if someone can help me out with. I have a method that's job is basically to return the entire table. It works, but returns the same row twice. Is there something I'm doing wrong with the iterator? public void TestListAllAppointments() { setUp(); //puts 4 rows into the database. Configuration cfg = new ...

23. Help on Hibernate query on Delete on duplicate rows    coderanch.com

This seems to me like an odd question. You say you are retrieving the object in the first instance from a select statement. Now if you are retrieving a full object, that object should have an ID (otherwise known as a primary key). So if you are to delete that from the table, then only the one row should be deleted. ...

24. Hibernate: Row count for pagination    coderanch.com

Well, I have seen some people run two queries. The first to get the entire count like select count(*) from Object o where... Then they do their second query as pagination. Now I recommend doing the first query once up front, so that on subsequent pages don't rerun that first query. Mark

25. hibernate: Selecting date rows for a whole day when the DB dates are down to minutes    coderanch.com

Hi, Is there a way to solve this problem? I have a table which holds Games and these have a date coloumn that is down to the minute. I would like to put in a date object into the search but it only has day, month and year set. I want it to pick up all the objects stored that are ...

26. hibernate - gathering multiple rows single column for two queries    coderanch.com

Hi there, I have a scenario where in there are two queries in Hibernate something like this i) select coldata from tablename where id=1 and ind='ABC' ii) select coldata from tablename where id=1 and ind='XYZ' Each will have a different output Currently I have two queries hitting the database. Is there a way where i can reduce this to 1 query ...

27. how could I limit the row count in delete query?    forum.hibernate.org

28. Hibernate query to return all the rows from first table    forum.hibernate.org

Hi Friends, Following is the requirement for me i am having two tables called vendor and dailyactivity Total transactions done by a vendor for everyday will be stored dailyactivity table now i need to get all the vendors and their transaction count if any in dailyactivity i.e it should return all the vendors and if they have transactions in dailyactivity it ...

29. How to get row count of existing criteria    forum.hibernate.org

For existing DetachedCriteria, how to get the row count of its query results? If we use projection like: DetachedCriteria existCriteria = ... existCriteria.setProjection(Projections.rowCount()); It will override existing projections(such as group by, if any), and row count will not be correct. I hope to have a new criteria wrapping over existing one and add rowCount projection to the new one. DetachedCriteria newCriteria ...

31. N Select Queries fired for 1 call( N = no of rows in view)    forum.hibernate.org

Newbie Joined: Tue Feb 16, 2010 11:31 am Posts: 2 Hi all, I have kept show_sql= true and i see that for one of my view that i created,when a hibernate query is called it is doing Multiple select queries. I have used Hibernate Reverse Engg to generate my Pojo's and Hbm files once i have created the view. I am ...

32. Counting rows with multiple group by clauses - Solved?    forum.hibernate.org

I recently ran across a problem that apparently a handful of posters share. Given a Criteria query that mimics the HQL: Code: select author.name, publisher.name, year, count(*) from Book group by author.name, publisher.name, year How do you get a row count? It's a problem for any query with more than one group by clause, and it gets particularly interesting for queries ...

33. how to get row count for query with group by    forum.hibernate.org

Hi, we use DetachedCriteria to construct query dynamically. The query has group by clause. For example select name, avg(age) from Student where city='NY' group by name; For a DetachedCriteria with group by, how to get the query result count? select count(distinct group-by-property) from Student where ... but there is no API for getting group by properties from DetachedCriteria. Thanks for help. ...

34. Too many rows being returned from a query    forum.hibernate.org

Hello. I'm passing an ArrayList of ids to my query. It shouldn't be returning all the rows of the table if only some of the ids are in the list, but somehow all the rows is what I'm getting. Can anyone help me with this? Thanks in advance. Code: public static List getByJob(List employment) { ...

35. HQL Query to find Duplicate rows in a table??    forum.hibernate.org

I am trying to convert the following SQL query to an HQL query, but cannot figure this out. This query bascially finds all the duplicate rows in a Contacts table according to company, firstname, and lastname. The simple "having" and "groupBy" query that I've seen on the web won't work since I need every row that is a duplicate. My sql ...

36. Count found rows    forum.hibernate.org

Author Message stephaneeybert Post subject: Count found rows Posted: Mon Jun 14, 2010 3:57 am Pro Joined: Mon Apr 16, 2007 8:10 am Posts: 213 Dear all, I have a PHP application with lots of MySQL statements for which the number of rows retrieved by the statements (ignoring the limit keyword) is needed. These MySQL statements make use of ...

37. Many-to-Many Query doesn't find any rows    forum.hibernate.org

Newbie Joined: Wed Dec 31, 2003 9:45 pm Posts: 19 I have two many-to-many relationships in my example, and the first one does not find any of the linked data, while the second one in the same program works perfectly. When I run the offending query directly in the database, it does find a row in the database, but as listed ...

38. How do you get the eqvivilent of a Row Count    forum.hibernate.org

39. MS SQL 2000: delete() can't find rows    forum.hibernate.org

Transaction t = hs.beginTransaction(); try { hs.delete("FROM " + Book.class.getName() + " AS book"); t.commit(); ...

40. Help! Duplicate rows inserted in sorted set    forum.hibernate.org

Newbie Joined: Thu Oct 07, 2004 9:06 pm Posts: 2 Here is my problem. I have a persistent collection (a sorted set) of RecordCountedItems within my Record object (see my mapping doc below). I am getting duplicate entries in my TaBRecordCountedItem table. I am not even calling save or update; the insertions happen when I call query.list(). I am possibly seeing ...

41. Query returns same object many times for diff database rows    forum.hibernate.org

Greetings, In my searches on google and here I have seen this problem discussed twice but no resolution was provided that I could find so I'm reposting... I have the following table (simplified for example) used for xref: ITEM1ID ITEM2ID TYPEID ---------- ---------- -------- 1 1 56 1 2 56 2 2 56 1 3 56 ITEM1ID and ITEM2ID are the ...

42. How to delete rows using Query/named query ???    forum.hibernate.org

Is it possible to delete a bunch of rows based on some column value using Query interface or the named query in the mapping xml ? For ex, if we write the following query in xml : delete from RptExpression as rptExpression where rptExpression.expressionID = ? and the following code in java : Query query = HibernateUtil.currentSession().getNamedQuery("delete.rptExpressions.for.particular.expressionID"); query.setInteger(0, ...

43. Unexpected row count: 0 expected: 1    forum.hibernate.org

Hibernate version: 3 Hibernate gives me following error message: Code: [java] Hibernate: update primer set name=?, seq=?, temp=?, content=?, where id=? [java] org.hibernate.HibernateException: Unexpected row count: 0 expected: 1 [java] at org.hibernate.jdbc.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:32) At this point there should be an insert not an update!. Whats wrong here? Code:

44. Select filters out null-value-rows    forum.hibernate.org

I try the following Query: Code: select proc.transportDevice, proc.driver, proc.coDriver from TransportProcess as proc proc.coDriver may be null, but the result does not contain any row where the proc.coDriver is null! They are filtered out! proc.transportDevice, proc.driver and proc.coDriver are all mapped Objects. Hibernate version: Hibernate 2.1.8 Mapping documents:

45. Duplicate rows when query with criteria without table join    forum.hibernate.org

Hi there, I am stucked with a very simple query with just 1 table. If I provide a criteria for the query, I received only the first row with the size of the array as duplicate entries (ie, if a total of 42 rows shall be found, I got the 42 rows but all from the first row.) If I dont ...

46. Hibernate 3.0 replicates the same row in a query    forum.hibernate.org

47. Incorrect row count when using Criteria.DISTINCT_ROOT_ENTITY    forum.hibernate.org

Newbie Joined: Mon Aug 01, 2005 10:41 am Posts: 6 I have two tables (parent/child relationship) where I am retrieving all the SimpleOrders for the SimpleHeaders that have a specific value in the medicalRecordNumber field. The list I am retrieving has the correct number of items. When I try to do a Projections.rowCount() for the same list, I'm getting an incorrect ...

48. Can't use createQuery to delete rows    forum.hibernate.org

I am having problem with the following (very simple) delete statement: Session s... Transaction t = s.beginTransaction(); try { Query query = s.createQuery("delete from TABLE1 where Node_No=?"); query.setInteger(0, 2); query.executeUpdate(); t.commit(); } catch(Exception e) { e.printStackTrace(); t.rollback(); } s.close(); The executeUpdate() throws this exception: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 at java.util.ArrayList.RangeCheck(Unknown Source) at java.util.ArrayList.get(Unknown Source) at org.hibernate.hql.ast.HqlSqlWalker.postProcessDelete(HqlSqlWalker.java:418) at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:175) at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:189) ...

49. 2 queries in a row produce an exception    forum.hibernate.org

Hi, I am experiencing a behavior by which 2 queries (one by HQL the other by Criteria) work if done independently, that is if I comment either it works, yet if run one after the other as written in the code, it produces the exception indicated. I have tried looking at the documentation and forum for similar issues but could not ...

50. Unexpected row count: 0 expected: 1    forum.hibernate.org

I have a java object, which holds a collection of people. When I insert these people into the database, I need to generate the key myself in my own code, since it is kind of complex and comes from a tabe with multiple columns that need to be looked at. For some reason, it wants to update the record, even though ...

51. Using the crit. API to find rows w/o a corresponding 1:1 rel    forum.hibernate.org

I created a many-to-one between Product and Category and creating a Criteria query like Criteria crit = session.createCriteria(test.Category.class).createCriteria("products"); crit.add(Restrictions.isNull("category")); and it did create a query like Hibernate: select this_.CATEGORY_ID as CATEGORY1_1_, this_.CATEGORY_NAME as CATEGORY2_0_1_, product1_.PRODUCT_ID as PRODUCT1_0_, product1_.PRODUCT_NAME as PRODUCT2_1_0_, product1_.CATEGORY_ID as CATEGORY3_1_0_ from CATEGORY this_ inner join PRODUCT product1_ on this_.CATEGORY_ID=product1_.CATEGORY_ID where product1_.CATEGORY_ID is null.

52. select count(*) returns multiple rows......    forum.hibernate.org

53. Returning 2 objects per row in a named query    forum.hibernate.org

[b]Hibernate version:2.1.8[/b] Most of my named queries return a single mapped object per row. These named queries are of course in the hbm.xml files. Is it possible, in a named query in the hbm.xml file, to return 2 mapped objects per row ?? For example, object A has a one to many assocation to object B. Currently, I have a named ...

54. Projection row count    forum.hibernate.org

Hi, I am using some pagination to display my objects. So I need to get my list ob objet and the total number of objects ... In version 2, I used Criteria.count() to get the total number of results. I just moved to version 3. So now I will have to use projections. I just added it in my code with ...

55. First row of the table is repeated in createquery result....    forum.hibernate.org

I am facing a weired problem.... I am running a query "from Customer"... List lst = session.CreateQuery("from customer").list; when I get a list object to the above result, list contains only first row repated to the lenght of rows in table, i.e, if table has 30 rows, first row is repeated in above list(lst object) 30 times......... Any clue regarding this ...

56. How to get row count of a query with group by?    forum.hibernate.org

I'm writing an application where users can formulate their queries on datasets (=entities) graphically, allowing them to hide columns, specify constraints and operators on them. The results are then shown in pages. In order to be able to display something like 'Page X of Y' I need the total count of rows the query would return if it was not paginated. ...

57. Safe to change BatchingBatcher to not count rows?    forum.hibernate.org

I would like to change org.hibernate.jdbc.BatchingBatcher and org.hibernate.jdbc.NonBatchingBatcher to fail silently if the number of rows inserted doesn't match the number it expected. I want to do this because I have a before-insert trigger that denies insertion on duplicate or banned rows, so if a row shouldn't be inserted "NULL" is returned to JDBC, signifying that no insert should be performed. ...

58. Criteria query returning single duplicate row    forum.hibernate.org

I am using criteria to build a dynamic sql statement dependent on the presence of incoming parameters. I run the query and it returns the correct data except for a single duplication of the very first record returned. Here's the particulars. Also, I noticed that if you do not createCriteria on dependant objects, they will not be autopopulated by the query. ...

59. The query returns duplicate rows!!!    forum.hibernate.org

I have got two entity objects Bug and User associated with each other by Many To Many relations The association is defined in this fashion in both Bug.java and User.java @ManyToMany(targetEntity = User.class, cascade = { CascadeType.PERSIST, CascadeType.MERGE }) @JoinTable(name = "BUG_USER", joinColumns = { @JoinColumn(name = "BUG_ID") }, inverseJoinColumns = { @JoinColumn(name = "USER_ID") }) public List getUsers() { return ...

60. How to avoid a select while updating a row?    forum.hibernate.org

Is this the only idiom to update the columns of a row:? //////////////////////////// Session session = Sessionfactory.openSession(); Transaction tx = session.beginTransaction() Foo foo = (Foo) session.load(..); foo.setXXX(...); foo.setYYY(...); session.flush(); tx.commit(); session.close(); ///////////////////////////////////// The problem with the above approach is the load(..) generates a select query and flush(...) issues an update query. Can anyone please provide me a clue on how to ...

61. Millions of rows - pagination    forum.hibernate.org

Hi, I have 2 millions of rows in a table. Implemented paging using Hibernate Criteria feature. The response time getting worse when the page offset increases. See the below table Page offset 0 3000 9000 12000 250K 500K 750K 1000k 1250k 1500k Response time in seconds 34 34 34 34 39 305 310 315 386 384 I think this may not ...

62. Hibernate Query returning the same rows    forum.hibernate.org

I am newbie to Hibernate. I am following hibernate mapping and the data in the datanase table looks something like RFQ_ID,COMBINATION_ID,PART_NO,ALT_PART_NO,MFG,GEN_PART_NO 457177,775107,LM339ADT,LM339AD,STM 457177,775109,LM339ADT,LM339AD,ONS 457177,775110,LM339ADT,LM339ADR,ONS When I use following code to get these three rows ...

63. how can I get row count on table    forum.hibernate.org

64. HOw to Get Distinct Row using hibernate    forum.hibernate.org

65. Unexpected row count: 0 expected: 1    forum.hibernate.org

Hi there: Maybe some of you can enlighten me, after having an app running for a long time I ve got this errors in my log. 2007-05-01 21:55:01,523 3123042484 ERROR [DefaultQuartzScheduler_Worker-9] org.hibernate.event.def.AbstractFlushingEventListener - Could not synchronize database state with session org.hibernate.HibernateException: Unexpected row count: 0 expected: 1 at org.hibernate.jdbc.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java: 32) at org.hibernate.persister.entity.BasicEntityPersister.update(BasicEntityPersister.java: 1982) at org.hibernate.persister.entity.BasicEntityPersister.updateOrInsert(BasicEntityPersister.java: 1909) at org.hibernate.persister.entity.BasicEntityPersister.update(BasicEntityPersister.java: 2149) at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java: ...

66. BatchUpdate returning unexpected row count after network dis    forum.hibernate.org

Hello all: I have an application that runs the same code on two different databases: one on a remote host (Oracle) and one on the local box (Cache). The remote host is used as the master repository and is used to update the local box periodically through Hibernate. Normally there is a network connection between the two boxes and everything works ...

67. how can i get the row count affacted in a trasaction    forum.hibernate.org

Hibernate 3.2.3 MySql 5.0.41 hi, everyone, i'm developing a project that needs to log every db operation into a table, for example, the log table maybe look as follows: tb_name | oper_type | row_affacted --------------------------------------------------- tb_user | insert | 1 tb_address | update | 3 --------------------------------------------------- that means i update 3 rows in tb_adderss and insert 1 row into tb_user in ...

68. Problem: Getting multiple identical rows back from a query    forum.hibernate.org

I need to get a list of all the CampaignQuestions related to a certain Campaign ID from our db. The following sql does the trick its really simple: Code: SELECT cq.QUESTION_TEXT, cq.CAMPAIGN_QUESTION_NO, cq.QUESTION_TYPE FROM CAMPAIGN_QUESTION cq WHERE cq.CAMPAIGN_ID = ? ORDER BY cq.CAMPAIGN_QUESTION_NO When I get the data back via Hibernate, rather than getting each (distinct) question, I get the ...

69. Row count with Criteria    forum.hibernate.org

70. Pagination is 3 times slower than getting all rows!    forum.hibernate.org

I'm using Liferay 4.2.1, and found some weird result with hibernate query. There's a query with an outer join, and here is the portion of the hql: Code: StringBuffer hql = new StringBuffer(); hql.append("from com.liferay.portlet.journal.model.impl.JournalArticleImpl as article "); hql.append("left join fetch article.categories cat "); hql.append("where cat.id=? "); hql.append("and article.primaryKey.groupId = ? "); hql.append("and article.approved=true "); hql.append("and article.expired=false "); hql.append("and article.displayDate <= ...

71. StaleStateException:actual row count: -1; expected: 1    forum.hibernate.org

I am getting an error when I try to do batch insert. Any idea when does oracle return "actual row count: -1". java.rmi.ServerException: RuntimeException; nested exception is: org.hibernate.StaleStateException: Batch update returned unexpected row count from update [3]; actual row count: -1; expected: 1at org.jboss.ejb.plugins.LogInterceptor.handleException(LogInterceptor.java:421) at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:209) at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:136) at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:648) at org.jboss.ejb.Container.invoke(Container.java:954) at sun.reflect.GeneratedMethodAccessor192.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155) ...

72. StaleStateException:actual row count: -1; expected: 1    forum.hibernate.org

I am getting this error when I try to do batch insert. java.rmi.ServerException: RuntimeException; nested exception is: org.hibernate.StaleStateException: Batch update returned unexpected row count from update [3]; actual row count: -1; expected: 1at org.jboss.ejb.plugins.LogInterceptor.handleException(LogInterceptor.java:421) at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:209) at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:136) at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:648) at org.jboss.ejb.Container.invoke(Container.java:954) at sun.reflect.GeneratedMethodAccessor192.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155) at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94) at org.jboss.mx.server.Invocation.invoke(Invocation.java:86) at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264) at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659) at org.jboss.invocation.local.LocalInvoker$MBeanServerAction.invoke(LocalInvoker.java:169) ...

73. Any reason for JPQL Query not to return all rows.    forum.hibernate.org

Hi, I'm encountering an issue where a JPQL Query is not finding an entity with a composite id that is clearly in the database. The values for the composite key are correct. In addition if I do a query to get all entities the number is less then the number of rows. *edit* select x from X x No joins where ...

74. No rows returned from some hibernate queries    forum.hibernate.org

The queries in question have been validated to have rows in the target database (oracle 10g) by a. setting show_sql=true b. cutting and pasting the sql generated by hibernate c. substituting the bind parameter ? with the query value, that is printed directly before the hibernate query is executed. About half of the queries are returning data properly and the others ...

75. Most effecient way to count rows    forum.hibernate.org

Hi, So I have two tables called "kiosk" and "venue". A venue can have many kiosks. I want to be able to count how many kiosks are at a given venue. Now this is really simple in SQL by... Code: select count(*) from kIOSK_INFORMATION where venueId=2; This returns 4 (which is the case for venueId 2). Now using hibernate I came ...

77. Count rows using hibernate criteria API    forum.hibernate.org

Hi, Can some one help me to findout maximum number of rows in the list of specified values of a column. Here is the seario. Table( value , id) Values ( value1,1 value1,1 value2,2 value2,2 value2,2 value2,2 } Now I want to write a qurey to get maximum count in the table for the specified ids. if I pass ids 1 ...

78. Optimized way to determine if query returns any rows?    forum.hibernate.org

yes i know, i am solid in ORM. this is a generic question, you want to know if there are zero, or more than zero instances of an object type w/ certain properties, i.e. whether a query will return any rows. as i said, i have a DetachedCriteria in hand. let me modify the equivalent SQL, it would be more like ...

81. Updating row with createSQLQuery    forum.hibernate.org