1. JPQL Create new Object In Select Statement - avoid or embrace? stackoverflow.comI've learnt recently that it is possible to create new objects in JPQL statements as follows:
|
2. Help me to write an sql-statement to do something like this stackoverflow.comYou can also write hibernate hql or criteria queries. I have Teacher entity and Student entity like this :
|
3. Java: JPQL select statement stackoverflow.com
|
4. HQL statements with no FROM and WHERE clause stackoverflow.comI am trying call a database-function from HQL. The HQL statement should just call the function and return its value, like this
If I try to call select current_timestamp() .
It ... |
5. Select after insert statement executed in Hibernate stackoverflow.comI want to know how should I select data after it has been inserted in database using hibernate. |
6. Many to one select statement? stackoverflow.comHow to select with relationship is many to one in JPA
in Many to One How to do select statement example
Student - Class |
7. Substring in select statement in JPQL stackoverflow.comI'm trying to |
8. Reusing Queries in Hibernate stackoverflow.comI use HQL queries in Hibernate, and just wondered, if I could increase the preformance of my app reusing queries. Usually you have to create a new Query object for each session:
|
9. Are we able Execute INSERT STATEMENT inside hibernate CreateSQLQUERY stackoverflow.comI have two keys for
and I want to insert them ... |
10. select statement in hibernate criteria stackoverflow.comI want to make the below query in hibernate criteria SELECT * FROM ORDERS O, PRODUCT P WHERE O.ORDER_ID=P.ORDER_ID and order.orderName='xyz'; thanks for your help |
11. jpa criteria query for my this sql statement stackoverflow.comHow do I construct a criteria query or jpql query for this sql statement
|
12. Select statement in from clause in Hibernate stackoverflow.comI have three tables named:
|
13. SQL statement, subquery count? stackoverflow.comI've got the following SQL tables Department
Employee
I would like to write a statement that returns
|
14. Hibernate subquery in select statement stackoverflow.comI am trying to find some way, any way, to perform a subquery inside a select statement using Hibernate, but have so far been unsuccessful. My preference would be a Criteria ... |
15. Hibernate not printing 'select' SQL statements stackoverflow.comI have a simple code snippet provided below along with the necessary hibernate configuration. The issue is all the 'insert' statements are being printed but 'select' statements are not printed.
|
16. JPA: can you use Select statement to create a column coderanch.com |
17. to_char() function in select statement of JPQL coderanch.comHi, I am a newbie to JPA specifically and O/R in general. I haven't been able to pass this bumper. I need some help here. Could you tell me whether it is possible to use to_char() function in the native query using Oracle TopLink? Basically, I have been trying to convert an entity attribute(in java.sql.Date type) to String using to_char() function ... |
18. Help framing Hibernate Criteria based on SQL statement with mutiple clauses. coderanch.comHi, I am trying to frame a Hibernate Criteria nased query for a SQL I am using in an application. The requirement is to find the name of all members who are not married or married with at least 2 children between the ages of {MIN_AGE} and {MAX_AGE}. The table structure and the SQL I use is below. MEMBERS - ID ... |
19. getReference causes a select statement forum.hibernate.orgpb00067 wrote: As I know you cannot avoid this select statement if you want to work with stateful persistent context. I you just want update entities without reading them first then you can use bulk updates feature on a stateless session. That's unfortunate. Anyway, the bulk update operations fulfilled my needs. The only problem I had was due to my inheritance ... |
20. wrong sql statement for a select count query forum.hibernate.orgHi When I execute this jpa query: select count(gr.members) from Group gr where gr.key = :key then the following sql statement is executed: select count(.) as col_0_0_ from model_group group0_, AbstractParty members1_ where group0_.id=members1_.group_id and group0_.key=? The Group object has a one-to-many relationship to Member Does anybody know why there is a dot between the brackets in the count function from ... |
21. Criteria and subqueries: how to make a not-in statement? forum.hibernate.org |
22. Implementing the "from (select..." statement in HQ forum.hibernate.orgHi all, I'm trying to implement an Oracle query containing the pattern "select ... from (select ... from...) ... " in HQL. As a simple example I would like to run the following Oracle query: select * from (select name, age from customer) I know that the query is nonsense, nevertheless I would like to make it work in hibernate just ... |
23. Session.find - executes update statement --why?? forum.hibernate.orgHibernate Version : 2.1 Database : Oracle 9i When I execute a session.find(query), it works fine and I get the correct List. But when I flush the session, a "update" statement is executed. I don't understand why there is a update statement. There is no problem with other calls like..load, saveOrUpdate, delete. I am only having problem with "find". Any input ... |
24. full select statement forum.hibernate.orgwhat is wrong with my column name? 13:21:10 SQL> desc dept Name Null? Type ------------------------------- -------- ---- DEPTNO NOT NULL NUMBER(2) DNAME VARCHAR2(14) LOC VARCHAR2(13) String sqlString = "SELECT dept.DEPTNO, dept.DNAME FROM Dept {dept}"; and domain class: public class Dept implements java.io.Serializable { private int DEPTNO; private String DNAME; private String LOC; ... } -Henry |
25. Multiple "count" statements forum.hibernate.orgHi! I would like to extract more than one count from a single table with different criteria. In SQL I would use scalar subqueries (subqueries inside the "select" statement) or unions, but none of them seems to be supported by Hibernate. Is there an alternative or I'm forced to use several queries or native SQL? Maybe with self-joins? What I try ... |
26. Unexpected token: FROM in statement [select from] forum.hibernate.org |
27. UPDATE function on SELECT statements??? forum.hibernate.orgHi there, Using Hibernate 2.1.4 MS SQL 2000 While trying to perform simple SELECT statements using a named SQL I noticed the following in a stack trace Code: HIBERNATE: WARN - SQL Error: 229, SQLState: 42000 HIBERNATE: ERROR - [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]UPDATE permission denied on object 'companies', database 'os', owner 'dbo'. HIBERNATE: ERROR - could not update: [gr.forthnet.openseas.models.Company#ANEK] ... |
28. where clauses in associative statements forum.hibernate.org |
29. LIKE Statement in Hibernate 2.1.6 forum.hibernate.org |
30. Deleting Objects Proxies results in SELECT statement forum.hibernate.orgDepends. You can set a class mapping to perform a "select-before=update," which in a highly concurrent environment is advantageous. It is very possible, for example, that another user in another application could have deleted the object in question. If the delete occurs outside the current Hibernate session, there's no way Hibernate can know that the delete occurs. So, Hibernate must do ... |
31. Changing Criteria Query Select Statements forum.hibernate.orgI am having a problem with the JDBC driver I am using regarding column aliases. The driver will execute the query ok, but when Hibernate tried to grab the value of the column by the alias, the driver throws an error. This is a problem with the DB driver and not with Hibernate. Here is my actual question though: I have ... |
32. Can't find the error in the SQL statement forum.hibernate.orgHi, Can someone please take a look at the error statement below which doesn't work in my program but works in any sql editor and maybe will be able to identify the cause of it. Thanks for help Hibernate version: 2 [b]net.sf.hibernate.QueryException: unexpected token: , [select * from service,servicedesc where (service.eqDesc_id = servicedesc.desc_id) and (service.SERVICE_TYPE='EQUIPMENT') and (servicedesc.SD_TYPE='EQUIPMENTDESC') and (eqDesc_model = 'model26') ... |
33. HQL select statement (newbie question) forum.hibernate.orgIf i execute an HQL select statement, referencing the pojo and it's properties, do I then have to iterate through the results and populate the pojo properties? ex. Iterator results = sess.createQuery( "select cat.color, min(cat.birthdate), count(cat) from Cat cat " + "group by cat.color") .list() .iterator(); while ( results.hasNext() ) { Object[] row = results.next(); Color type = (Color) row[0]; Date ... |
34. Unable to read query statement forum.hibernate.orgI am using Hibernate 3.0.5 with weblogic server 8.1, sp4. When i am writing query to read rows from the databse table from main ()function it is working fine. But when deploys this application into weblogic server i am getting the following exception . CharScanner; panic: ClassNotFoundException: org.hibernate.hql.ast.HqlToken My select query is List lst=session.createQuery("select d.dname from Dept d").list(); Thanks |
35. Hide Query select statement. Urgent Please help! forum.hibernate.org |
36. Property values in select statement forum.hibernate.org |
37. Is there a way to exclude a property from a select statement forum.hibernate.orgI am using hbm2java and I have properties in my hbm files that are not mapped to columns in my database. I want hbm2java to generate the attribute along with getters and setters but I do not want hibernate to add the attribute to a select statement. I see that there are update=false and insert=false attributes but is there a select=false ... |
38. Select if(Statements) forum.hibernate.orgDear Hibernate Experts!! I am having a select query to process using hibernate...The following is the syntax " private static final String MYQUERY = "select (if FP.fatherid=0,FP.pid,FP.msid) as msid, FP.level "+ "from Parts FP, Parts P "+ "where P.fatherid=FP.pid and P.pid=?"; List msidList = getHibernateTemplate().find(MYQUERY ,pid); and following is the error message which I get in Tomcat java.lang.IllegalStateException: No data type ... |
39. Order of statements forum.hibernate.orgI see strange behavior of Hibernate, if this is documented somewhere, please give me more or less precise reference on documentation item. Order of SQL statements is not same as order of invocations. First I remove all User's, then I add new one. But I see insert first and delete only after insert. Why? What if I will delete bean and ... |
40. Order by on statement does not work in code but in hibernate forum.hibernate.orgI have the following query that retrieves childscorecards from the parent based on effective date in a many to many relationship: select scorecard from Scorecard scorecard join scorecard.parents as parent where parent.id.id = :scorecardId and :date between scorecard.effectiveDates.startDate and scorecard.effectiveDates.endDate order by scorecard.order When I run this in the hibernate console it works as expected but when I run it in ... |
41. newbie: Update Statement Query Exception forum.hibernate.orgSession session = sessionFactory.openSession(); Transaction tx = session.beginTransaction(); String hqlUpdate = "update Customer c set c.name = :newName where c.name = :oldName"; // or String hqlUpdate = "update Customer set name = :newName where name = :oldName"; int updatedEntities = s.createQuery( hqlUpdate ) .setString( "newName", newName ) ... |
42. J2EE Sort and Pagination Query Statements forum.hibernate.orgNewbie Joined: Tue Jul 11, 2006 11:11 am Posts: 2 I am accessing a database table. It works if I provide the sortBy (a String) and orderBy (a String) to sort that table. I am able to get the sorted result. It also works if I retrieve that table and apply my pagination utility. I am able to disply my web ... |
43. SELECT INTO command not allowed within multi-statement trans forum.hibernate.orgI am getting this exception. I have read some of the responses but did not get a perfect answer yet. One response say to update the server.xml with database configuration, but I don't want to do that. Hibernate version: 3.0 Mapping documents: Code: |
44. hql select statement error, can you take a peek. forum.hibernate.orgCould someone more skilled in HQL please take a look at my query.. I am doing something wrong and after fooling with it for more time than I have, I still do not have it working.. I know that it is something simple, but once again inexperience is proving to be a horrible thing.. here is my HQL statement which you ... |
45. how to use select statement using hibernate forum.hibernate.org |
46. Statement Sorting on insert forum.hibernate.orgHi, is it possible to sort the sql statements when inserting objects in the database? In JDO this is possible but in Hibernate until now from what I found out one has to manually save the objects in the correct order. Is there a was to enable statement sorting in Hibernate? Thanx, Jan |
47. Select Statements during saveOrUpdate forum.hibernate.orgNewbie Joined: Wed Nov 02, 2005 4:48 pm Posts: 4 Hello, I'm seeing Hibernate run a select statement for every object I try to persist with saveOrUpdate. How do I get rid of them? I read in Java Persistence with Hibernate (pages 528-529) that this can happen when the objects have a natural composite key and no versioning, which is what ... |
48. Select statement forum.hibernate.org |
49. When adding criteria an extra select statement is executed forum.hibernate.orgHi, We have a problem when searching for Job objects in the database using hibernate. When searching we do a join between the Job object (table) and the Customer object (table). In our search method we have a number of criteria ( DetachedCriteria criteria = DetachedCriteria.forClass(JobImpl.class) ) and it works fine. The sql generated by hibernate shows that is an inner ... |
50. SELECT statements issued when item w/collection is udated... forum.hibernate.orgHi, I have a class Track which has the followig collections - Shares - Agreements - Keywords - Files Every time i update a given Track instance through the update() method, Hibernate issues a series of SELECT statements (which, as far as i can see, purpose is to update the collections). Is Hibernate updating the collections every time i update a ... |
51. Position of exists clause in hql-statement forum.hibernate.orgAfter having tried a bit with the following statement i found out that the position of the exists clause seems to be relevant for hibernate: Code: @NamedQuery ( name=ModuleSubscription.QUERY_FIND_SUBSCRIBERS, query= "select ms.subscriber from ModuleSubscription as ms where ... |
52. HQL Select statement in From clause forum.hibernate.orgAfter too much trial and error and reading all the HQL material I could find I was hoping someone might have experience with the following and point me in the right direction. I currently use the following SQL statement to retrieve projected data associated with only the highest versioned Name, Version pairs listed in a table: Code: SELECT r.rule_id, r.rule_name, r.version ... |