jdbc « Query « JPA Q&A





1. SQl Query to Hibernate Query    stackoverflow.com

I have a MYSQL query that I use to retrieve random rows from a table. The query is : SELECT * FROM QUESTION WHERE TESTID=1 ORDER BY RAND() LIMIT 10; Now I need ...

2. Hibernate or JDBC    stackoverflow.com

I have a thick client, java swing application with a schema of 25 tables and ~15 JInternalFrames (data entry forms for the tables). I need to make a design choice ...

3. Using sql column names in hibernate createSQlquery result    stackoverflow.com

i have a couple of sql views with composite primary keys that i want to query, and since Hibernate makes it a pain to work with composite keyes, im using ...

4. How to avoid this very heavy query that slows down the application?    stackoverflow.com

We have a web application running in a production enviroment and at some point the client complained about how slow the application got. When we checked what was going on with the ...

5. How to get all the element from JDBC query    stackoverflow.com

HI, I have query like this

final Query contractQuery = cgnDao.getEntityManager().
            createNativeQuery("SELECT k.phrase, ak.type FROM key k INNER JOIN adkey ...

6. Hibernate criteria query using Projections.rowCount() causes a numeric overflow    stackoverflow.com

I'm using Oracle 11g R2. I have a table with 9.1 billion rows. When I try to run a criteria query which contains Projections.rowCount() (which I need to do to get ...

7. How to select multiple columns with the same name using JPA native query?    stackoverflow.com

I'm having some troubles while selecting some data using sql native query through JPA. That's because I have 3 columns with the same name, "descricao". When I execute the select operation through ...

8. number of select and update queries for benchmarks?    stackoverflow.com

I don’t really understand why 30 000 objects need 3000 selects and 3000 updates, do you think that these numbers are arbitrary? Ie. Could they have used 30 000 selects and ...

9. hibernate reverse engineering in Netbeans cannot find SQL Server tables    stackoverflow.com

I have a Test SQL Server database installed on my machine. Created a test SQL Server account and two tables were created with this account in TestDb on the default schema. On my ...





10. Hibernate not finding Oracle driver - despite straight JDBC working    coderanch.com

tomcat 5 / hibernate 2 / oracle 10g - Could not obtain connection metadata org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null' Been at this a few hours now - just cant get hibernate to work. I have my driver in the right place (web-inf/lib and also tried common/lib too), my config file and properties files all ...

11. hql query to get records of the week    coderanch.com

12. hql query to get records of the week    coderanch.com

13. Terminate long query in Hibernate?    coderanch.com

Hi all: I have question on how to kill a long query run in Oracle 10 g, Let's say, I have an web app using Hibernate/Oracle/Spring On the app, i put in some term to search for, if the query run too long, i want to hit a Cancel button and it will kill the background query, not the connection to ...

14. Select all row values using JPA    coderanch.com

15. Too many queries , JDBC vs Hibernate    coderanch.com

Consider this scenario, Table A : aId (PK) Table B : bId (PK) Table C : cId (PK), aId (FK), bId (FK) Now, I want to add one row into table C, Hibernate : - Load table A object (1 query) - Load table B object (1 query) - Set both objects into table C object. - Save table C object ...

16. Help query with hibernate    java-forums.org

Hi to all, I have this java code with hibernate: Session s = HibernateUtil.currentSession(); s.clear(); ArrayList result = new ArrayList(); Criteria crit = s.createCriteria(MyObjectObjclass); if((date1!=null)&&(!date1.toString().trim().equals (""))&&(date2!=null)&&(!date2.toString().trim().eq uals("")) ){ crit.add(Restrictions.between("data",date1,date2 )); } crit.add(Restrictions.eq("objectType", "anObjectType")); if((myObject.getCodObject()!=null)&&(!myObject.get CodObject().toString().trim().equals(""))){ crit.add(Restrictions.eq("codObject", myObject.getCodObject())); } ProjectionList proList = Projections.projectionList(); if(myObject.getObjectType()!=null){ proList.add(Projections.groupProperty("object_type ")); } if(myObject.getTotalSmiles()!=null){ proList.add(Projections.sum("totalSmiles"),"totalS miles"); } crit.setProjection(proList); result.addAll(crit.list()); return result; But, the sql that results from the ...





17. hql query    java-forums.org

18. hibernate distinct query    java-forums.org

Hi, I have a query, with many joins, executed by hibernate. This query contains many joins. Only some values from the database must be retrieved, and there can be several conditions in the where clause. Now the thing is that the same result is returned many times. So I used the DistinctRootEntityResultTransformer, unfortunately the result is still the same. I have ...

19. SQL query to HQL    java-forums.org

INSERT INTO MonthlySubscription (MSISDN, PKGNAME, REQUESTON, TOTAL) SELECT tbl.MSISDN, tbl.PKGNAME, tbl.REQUESTON, SUM(tbl.total) as TOTAL FROM (SELECT MSISDN, PKGNAME, TRUNC(REQUESTON) as REQUESTON, COUNT(*) as total FROM SUBSCRIPTION WHERE TRUNC(REQUESTON) = '15-MAR-11' GROUP BY MSISDN, PKGNAME, REQUESTON UNION ALL SELECT MSISDN, PKGNAME, TRUNC(REQUESTON) as REQUESTON, COUNT(*) as total FROM SUBSCRIPTION_HISTORY WHERE TRUNC(REQUESTON) = '15-MAR-11' GROUP BY MSISDN, PKGNAME, REQUESTON )tbl GROUP BY tbl.MSISDN, ...

20. where clause in hibernate    java-forums.org

21. Hibernate order by query thru java solution urgently reqd    java-forums.org

hi, i am using java with hibernate . i want to run a hibernate order by query thru java. i have written the query in hibernate.hbm.xml file. the query is as follows: query SELECT distinct a.process_id, a.name name, a.category_id,c.parent_id FROM tbl_process_master a, tbl_category c where (lower(a.name) like :searchString or lower(a.description) like :searchString or lower(a.meta_tag) like :searchString ) and a.status=:status and a.category_id=c.cat_id ...

22. Hibernate sql query    java-forums.org

23. time comparison: executing query with JDBC and hibernate    forum.hibernate.org

anthony wrote: you really have to understand what is a session and a transaction http://blog.hibernate.org/cgi-bin/blosx ... find&path= Thanks for that link, that is very interesting. Sometimes I have a handful of transactions and I do a new session for each. Gavin says this (session-per-operation) is an antipattern. Understood. Is this because of performance? Besides caching, if I compare session-per-operation and session-per-request, ...

24. HQL to SQL Transation Solution - for JDBC queries    forum.hibernate.org

Author Message jaybytez Post subject: HQL to SQL Transation Solution - for JDBC queries Posted: Thu Jan 20, 2005 1:23 pm Regular Joined: Tue Nov 30, 2004 4:23 pm Posts: 59 So I ran the API through the debugger and had quite a few methods on how I thought I could solve the ability to translate HQL to SQL, ...

25. Invalid JDBC time escape with Native SQL query    forum.hibernate.org

Page 1 of 1 [ 1 post ] Previous topic | Next topic Author Message eldiosyeldiablo Post subject: Invalid JDBC time escape with Native SQL query Posted: Mon Jun 13, 2005 2:01 pm Beginner Joined: Mon Jun 21, 2004 2:41 pm Posts: 40 When we try to do a simple native ...

26. Trying execute query directly through jdbc    forum.hibernate.org

Hello. I'm facing a strange problem. I'm developing an integration tool that will obtain data from other application and update values on a table. To avoid overhead by hibernate class loading (there is about 7000 updates), I'm trying to execute update querys directly on database. But on first query execution, the method freezes. Even debugging the code, the thread never finishes ...

27. Pagination JDBC    forum.hibernate.org

28. Query.setComment() not working with mysql jdbc driver 5x+    forum.hibernate.org

We are using Hibernate 3.1.3 and access mysql with mysql jdbc driver 5.x+. We can pass a sql comment to the mysql server with a straight jdbc call ( the comment will show up the db server log) but it does not work when we use the Query.setComment() API. Is this is a known issue, has it been fixed or what ...