problem « SQL « JPA Q&A





1. SQL to HQL problem    stackoverflow.com

I want to write this query in HQL but I can't. whatevere I do it seems wrong and hibernate throws exceptions. Could you please help me?

select t.users from (select user_id as ...

2. JPA problem: wrong sql in first execution    stackoverflow.com

Hallo all. I have a java enterprise application with spring, spring-integration, jpa for persistence with eclipse-link deployed on oracle weblogic 10.3. The application is event-driven: there's 1 MDB that reads from a JMS ...

3. Translating from SQL enquiry to HQL enquiry problem    stackoverflow.com

I'm a hibernate user for only a few days and I came across a certain problem. I can't work-out how to translate this SQL query into HQL:

SELECT name, street, city, description
  ...

4. Hibernate native sql problem    coderanch.com

I am trying to execute sql native query using hibernate 3.3.2.GA. I have following query. session.createSQLQuery("SELECT {dept1.*}, {dept2.*} FROM Dept d1, Dept d2 WHERE d1.deptId = d2.deptId"). addEntity("dept1",com.test.pojo.Dept.class). addEntity("dept2",com.test.pojo.Dept.class). list(); Mapping file for Dept class is

5. SQL_CALC_FOUND_ROWS problem    forum.hibernate.org

I am using JPA\Hibernate with MySql. I am executing a native query with SQL_CALC_FOUND_ROWS and a limit along with a "SELECT FOUND_ROWS()" query. There are certain times where the found_rows query is returning the wrong result. I looked in the MySql query logs and saw that a query "SHOW CHARACTER SET" is being executed between the SQL_CALC_FOUND_ROWS query and the FOUND_ROWS ...

6. ASTQueryTranslator Problem (HQL to SQL)    forum.hibernate.org

I run into a problem in translating HQL Queries having correlated subqueries to HQL in the context of a HQL-Bulk insert / DML-style operations. Here ist the HQL select: Code: select base.p2 as p2,sum(base.p4) as p4,sum(base.p6) as p6, (select sub5.p5 from MarketSample as sub5 where sub5.id = min(base.id)) as p5, (select sub0.p0 from MarketSample as sub0 where sub0.id = max(base.id)) as ...

7. SQL to HQL problem    forum.hibernate.org

Hi, I am unable to convert this SQL into HQL, any help will appriciated. I am not able to use the "group by" correctly. String queryString = "select message_num from rib_message msg" + " where message_num in (" + " select min(message_num)" + " from rib_message {msg_inner}" + " where (jms_queue_id = ?" + " or jms_queue_id is null)" + " ...

8. Getting problem with one-to-many related SQL    forum.hibernate.org

Hello everybody! I am working on a big project. The database is designed in the beginning without considering Hibernate concerns. Now we are using Hibernate for automated persistence. I am facing this problem with CMR. I am using cascade=all with one-to-many relation in Source entity mapping. When I am saving source entity Hibernate is generating i) INSERT query for SOURCE entity ...

9. Native SQL problem..    forum.hibernate.org

Hi, I have a bytea column which I want to return as a base64 string. If I run the following sql query in postgreSQL (7.4.1): Select encode(a.artist_photo2, 'base64') as artist_photo2 from artisttbl a where a.artist_id=46 I get: artist_photo2 /9j/4AAQSkZJ.......more base64....... If I run the same query in hibernate(Version 2.1.1) I get: 10:36:14,689 DEBUG SessionImpl:528 - opened session 10:36:14,691 DEBUG JDBCTransaction:37 - ...





10. Problem Urgent about sql    forum.hibernate.org

Can I create sql instructions without mapping table in Hibernate. Example: I have a table call "TB_PESSOA" and some atributes like "CD_PESSOA", "NM_PESSOA", "DT_NASCIMENTO". And I wanna do this sql: SELECT * FROM TB_PESSOA or specified some static or dinamic condicions SELECT * FROM TB_PESSOA WHERE CD_PESSOA = {} AND NM_PESSOA = 'GOMES' WHO CAN I DO THIS? THANKS.

11. A problem with the variable sql_show    forum.hibernate.org

Hello, Hibernate Version 2.1 i have a problem with the variable sql_show hibernate.cfg.xml Even it is in true I can't have sql errors details, this is my hibernate.cfg.xml: true true oracle.jdbc.driver.OracleDriver jdbc:oracle:thin:***** ***** ***** 5 net.sf.hibernate.dialect.OracleDialect

12. Problem of generate SQL    forum.hibernate.org

hi , during testing hibernate env: Redhat8.0 + tomcat4.1.27 + jdk1.3.1_09 + cocoon2.1.2 + hibernate2.1.2 + progress 91D problem: SQL generated cannot be executed in tomcat log file, the following SQL had been genereated : Hibernate: select ywod0_.ywod_lot as ywod_lot, ywod0_.ywod_model as ywod_model, ywod0_.ywod_prodline as ywod_pro3_ from PUB.ywod_det ywod0_ where (ywod0_.ywod_lot=? ) - exception clearing maxRows/queryTimeout java.sql.SQLException: [JDBC Progress Driver]:Optional feature ...

14. One-to-many inverted sql problem..    forum.hibernate.org

Beginner Joined: Tue Sep 21, 2004 1:49 pm Posts: 33 Location: Bogota, Colombia Hi, I'm using 3 classes, Person, Student and Relative. Student extends Person, and has a collection of Relatives (it's an object that contains the Student id, the Person id, its relationship, and a field that denotes if the person is responsible for the Student) In the insertion process, ...

16. SQL case when problem with Cloudscape    forum.hibernate.org

Hibernate version: 2.1.4 Database version Cloudscape 10 HQL BillConfig.getAllBillingConfigurationsByOwnerId = SELECT BC FROM BillConfig BC WHERE BC.reportConfig.usageContract.owner.id = :ownerId GROUP BY BC Generated SQL and error select billconfig0_.ID as ID1_, case when billconfig0__3_.ID is not null then 1 when billconfig0__4_.ID is not null then 2 when billconfig0__5_.ID is not null then 3 when billconfig0__1_.ID is not null then 4 when billconfig0__2_.ID ...





17. Problem with the sql generated using hibernate unknown colum    forum.hibernate.org

Need help with Hibernate? Read this first: http://www.hibernate.org/ForumMailingli ... AskForHelp [b]Hibernate version:[/b] Hibernate 3.0. [b]Mapping documents:[/b] 1.HistoryEntry ---------------- ...

18. show-sql problem    forum.hibernate.org

hi everybody, i've got a small problem. how do i get to see the sql created by hibernate? in my hibernate.cfg.xml file i included true however i still don't see the sql. can anybody give me a hint? i am using hibernate 3.05, mysql 5.01 and eclipse. thanks in advance, cheers nick

19. Hibernate HQL and SQL translation problem    forum.hibernate.org

Hi, Below is my HQL and translated SQL. [select man from Manifest man join man.manifestPorts as m_port join man.voyage as voyage1 join man.voyage as voyage2 where voyage1.svcLoop =? and voyage1.vesselCertificate = ? and voyage1.voyId = ? and voyage1.voyDir = ? and man.callNum =? and man.customsPort= ? and voyage2.svcLoop =? and voyage2.vesselCertificate = ? and voyage2.voyId = ? and voyage2.voyDir = ? ...

20. Hibernate HQL and SQL translation problem    forum.hibernate.org

Hi, Below is my HQL and translated SQL. [select man from Manifest man join man.manifestPorts as m_port join man.voyage as voyage1 join man.voyage as voyage2 where voyage1.svcLoop =? and voyage1.vesselCertificate = ? and voyage1.voyId = ? and voyage1.voyDir = ? and man.callNum =? and man.customsPort= ? and voyage2.svcLoop =? and voyage2.vesselCertificate = ? and voyage2.voyId = ? and voyage2.voyDir = ? ...

21. Hibernate-SQL-Problem    forum.hibernate.org

22. native SQL to HQL problem, please help    forum.hibernate.org

23. HQL Problem - right results from SQL but not from Hibernate    forum.hibernate.org

select person0_.LastName as col_0_0_, empevents1_.Event_Value as col_1_0_, empevents1_.EventDate as col_2_0_ from People person0_ inner join People_Emp_Events empevents1_ on person0_.Person_ID=empevents1_.Person_Link where empevents1_.Event_Link=231 and empevents1_.Event_Value<>'A' and ( empevents1_.EventDate between '9/1/2007' and getdate() )

24. Logging SQL with Log4j - problem    forum.hibernate.org

The show_sql property just enables logging to System.out. The logging equivalent is the org.hibernate.SQL category. Do you have the log4j in your WEB-INF/lib dir? If you are still having problems, and are using tomcat, try placing a copy of log4j.properties in common/classes or shared/classes. You can also get diagnostic output from log4j by specifying -Dlog4j.debug=true on the webserver command line.

25. translating sql to hql problem    forum.hibernate.org

UPDATE Table1 AS one SET col1 = two.col2 FROM Table2 AS two WHERE two.col1 LIKE one.col2 [/code[ The query is updating table one based on the results of the select query. HIbernate doesnt like the use of FROM in this query. A subquery will generate more than one row in this instance. Any ideas would be great!