1. Using native-sql in Hibernate - how to handle results stackoverflow.comI have couple of tables, where I cannot use hibernate mappings to define associations (or I don't know how to do them).. so I have decided to use nativesql when trying ... |
2. Hibernate with native SQL issue coderanch.comAnkur, When you use 'select' in either an HQL or native SQL query, Hibernate does not return the object in your 'from' clause. Just as when using non-Hibernate SQL, 'select event.* ...' returns all the columns from the event table. The List you get back from your query is a list of Object[] (object arrays). Each element in the list is ... |
3. why HQL,QBC,Native Sql in hibernate?reasons needed.. coderanch.com |
4. Native SQL forum.hibernate.orgI have written a SQL query in hibernate to retrieve attributes from different tables and i want to map these attributes to custom object by hibernate itself.Is there any way to do this? Currently i have used list method in SQLQuery and mapped Object[] to the customObject array using index. Thanks, Arjun M |
5. Invalidating Space happens after every native SQL execution forum.hibernate.orgI am using an EhCache for my second level cache and I have run into an issue where everytime I execute session.CreateSQLQuery(), the cache discards all objects. I use the createSQLQuery to execute a table level lock on a table (I am using a database which requires a LOCK FOR ACCESS in order to allow concurrent reads and writes to be ... |
6. Native SQL "in" does not work properly forum.hibernate.org |
7. strange behaviour with native SQL and addentity forum.hibernate.orghey guys. i've got a strange behaviour with my native SQL-Query. What i want: i don't want to map scalar results afterwards in a for loop, instead i try to determine the objects in my query through addentity (see query below). well, it nearly works. i get my objects (user, permission, orgunit) and i can access their attributes and all (works ... |
8. Need help in Externalized Native sql in hibernate forum.hibernate.orgHI All, I have table with 30 columns and I mapped those to one entity value object. Now I need to get only three columns from that table. For that I had written One externalized native sql query in hbm file. I need to get these result in to my customized another value object, that value object having those properties only. ... |
9. Native SQL -- Does addJoin() work? forum.hibernate.orgNewbie Joined: Wed Dec 29, 2010 6:36 pm Posts: 4 There are many similarly titled posts on here where the author is talked away from using native sql. In my case, I require a union, which, correct me if I'm wrong, isn't supported in hql or criteria, so I must go native. Now that I've done so, I need to work ... |
10. Native SQL calling forum.hibernate.orgMy main reasoning for not wanting to do this is because a valid sql query for this example does not need it, like the first jdbc example I posted. It's just a seperation of concerns issue. Our DBA may be writing some of the more complicated queries and there's not really a reason for him to know anything about our objects ... |
11. SQL Native by creatSQLQuery Bugs !! forum.hibernate.orgHi all, I'm working with Oracle9i via JDBC and I've find a bug is the createSQLQuery method (I think it's a bug, perhaps i'm mistaking...). Indeed, when I try this : createSQLQuery("select {mytab.*} from MYTABLE {mytab} where {mytab.idtable}=1", "mytab", MyTable.class); Hibernate generate a query like : select MYTAB.IDTABLE AS IDTABLE0_, MYTAB.TABLENAME AS TABLENAME0_ [...] FROM MYTABLE MYTAB WHERE IDTABLE0_=1 It generates ... |
12. Native SQL Bug? forum.hibernate.orgHibernate 2.1 with Spring Framework on jboss 3.2.3 with mysql 4.0.15 Im trying to generate a Native SQL something like getHibernateTemplate().execute( new HibernateCallback() { public Object doInHibernate(net.sf.hibernate.Session session) throws net.sf.hibernate.HibernateException, SQLException { String sql = "select {project}.PROJECT_ID from PROJECT {project}, " + " PROJECT_PROJECTGROUP {grp}" + " where {project}.PROJECT_ID = {grp}.PROJECT_GROUP_ID" + " and {project}.PROJECT_ID = " + id; String[] aliases ... |
13. Native sql in hibernate forum.hibernate.orgHibernate version: - Hibernate 2.1.2 Mapping documents: Code between sessionFactory.openSession() and session.close(): Full stack trace of any exception that occurs: ************* initialize the sessionFactory *********** net.sf.hibernate.impl.SessionFactoryImpl@385f6c3a Hibernate: select ttkwqworkq0_.QUE_ID as x0_0_, ttkwqworkq0_.QUE_DESC_X as x1_0_, ttkwqworkq0_.NODE_ID as x2_0_, ttkwqworkq0_.FID_CO_NM as x3_0_, ttkwqworkq0_.SYS_ADM_GRP_C as x4_0_, ttkwqworkq0_.USE_NODE_TRNF_RULE_I as x5_0_, ttkwqworkq0_.DEL_I as x6_0_, ttkwqworkq0_.MOD_DEST_I as x7_0_, ttkememail1_.EMAIL_ADDR as x8_0_, ttkememail1_.SEND_MAIL_IND as x9_0_ from T_TKWQ_WORK_QUE ttkwqworkq0_ ... |
14. Native SQL using hibernate forum.hibernate.org[b]Hibernate version:2.1.6 Hi, I am new to hibernate, I would like to try out whether hibernate allow to use native SQL in query? I found this topic in |
15. Native SQL and derived classes forum.hibernate.orgNewbie Joined: Tue Nov 16, 2004 6:27 pm Posts: 1 Hi, I wonder if any of you could help me get a start on this problem. I would like to use a query that contains MySQL functions in the where clause (see below), through Hibernate. If I could just get a working strategy for the general problem, I'm sure I can ... |
16. Native SQL forum.hibernate.orghi, whu this query does not work ? : Query q = session.createSQLQuery("SELECT {mot.*} FROM t_mot {mot}" + "where {mot.intitule} = 'baum'", "mot" , Mot.class); result = (ArrayList) q.list(); thx a lot ? error msg : Caused by: java.sql.SQLException: Syntax error or access violation message from server: "You have an error in your SQL syntax. Check the manual that corresponds to ... |
17. Native SQL, how to? forum.hibernate.org[b]Hibernate version:2.1.6 Hi just a stupid question - I have a table with columns idclient uid ... I'm trying to call List list = session.createSQLQuery("select {c}.idclient as {c.idclient} FROM SupClient {c}", "c", SupClient.class).list(); - so I'm interresting about only one column from table (the true story is much more complicated including outer join of 4 tables). The result is exception - ... |
18. Native SQL forum.hibernate.orgA newbie to Hibernate but very interested so far. Is Hibernate able to execute generalised SQL statements which are not bound to any objects. eg - perform some clean up of another table for which we have defined no objects - call arbitary Stored Procedres which do not return any objects Basically I want to know if we can issue SQL ... |
19. How to perform a native SQL operation? forum.hibernate.org |
20. help : Native SQL & (HQL example in Hibernate in Action) forum.hibernate.orgHi Everybody, I have a complex Oracle Query and very simple class to map with For example select a.emp_name, b.dept_name, c.salary_amt from emp a, dept b, salary c where a.emp_no = c.emp_no and a.dept_id = b.dept_id and emp_id in (select emp_id from current_emp); and class Employee with attributes (emp_id, emp_name, age, sex, joining_dt, rank, dept_name, salary_amt) Note that there are several ... |
21. How to I use Native sql using creatSQLQuery forum.hibernate.orgsql += "SELECT "; sql += "{gt.gs_team_id} "; sql += "FROM GS_TEAM gt "; sql += "inner join TEAM_DETAIL td ON {td.team_id} = {gt.team_id} AND {td.DRAFT_GS_TEAM_ID} = {gt.gs_team_id} "; sql += "inner join TEAM t ON {t.team_id} = {td.team_id} "; sql += "inner join STORE s ON {s.store_id} = {t.store_id} "; sql += "WHERE "; sql += "({s.store_id} = " + ... |
22. Using native SQL forum.hibernate.org |
23. Native SQL and addJoin forum.hibernate.orgNewbie Joined: Mon Mar 06, 2006 5:20 am Posts: 7 Hibernate version: 3.0.5 Name and version of the database you are using: oracle 10.2.0.1.0 Hi, I'm having an issue with the addJoin method when using native SQL. I am not sure I fully understand how it works... I use the following code (simplified for the sake of clarity) : Code: Query ... |
24. retrieving assembled objects with native sql forum.hibernate.orgUsing a left join fetch in hql, I'm able to retrieve a list made up of parent objects, with a set of child objects nested inside of it. However, when I try using native SQL (ether by .createSQLQuery() or a named query), I end up with a list of objects, each object containing the parent object, and standalone child objects (not ... |
25. different between native sql and hql forum.hibernate.orgHey, I have some tables that i only update the table (records events) and dont neet to read from this tables. once in a while (around 2 hours) i need to clean thos tables (around 600000 records). i want to run delete low_priority but it dosnt support in hql so i run it with native sql. do i need to consider ... |
26. using native SQL in hibernate forum.hibernate.orgSession.connection returns an javax.sql.Connection through which one can create either statement or prepared statement manually and manage jdbc transaction manually as well. Where as in Hibernate the SQLQuery object's query will depend how the sql string is created. If the string is created with parameters in that case the statement internally created by hibernate is a prepared statement and if the ... |
27. Native SQL and Hibernate 3 forum.hibernate.orgHello, I'm using Hibernate 3 and your Native SQL support, however there are any problems as to have to save my SQL queries strings in .xml files. How can I make these Native SQLs more dynamics? Like concatenate them based in condictions. How can I workaround this? Thanks very much! Ary Junior |
28. native sql forum.hibernate.orgThis is probably really simple but going through different documentation its hard to find a clear example... I want to use native sql with no entity mappings to select data so here is the senario: Table create table USER( USER_ID INT(15) NOT NULL, FIRSTNAME VARCHAR(15) NOT NULL, SURNAMR VARCHAR(15) NOT NULL,, PRIMARY KEY (USER_ID)); I know how to do this using ... |
29. Mixing legacy native SQL code with Hibernate in large app. forum.hibernate.orgDear all We are about to migrate a very big application from pure SQL statements to Hibernate 3.1. We mapped a DAO to each table and in a perfect world we would use only DAOs to access the persisted data. But since there is a deadline and we cannot possibly replace all native SQL with HQL or DAO access, we are ... |
30. native sql forum.hibernate.org |
31. How to Write HQL for the native SQL forum.hibernate.org |
32. Dynamic add condition to native sql forum.hibernate.orgI define a named native SQL. But the where condition is not static. It must dynamic add according input parameter. How can I do? Named native SQL is: |
33. HQL to native SQL forum.hibernate.orgHi, I have an uncommon (I guess) problem. After I create a Query object with HQL statement, is there a way to get corresponding native SQL query string from it? It happens that I have a bunch of display filters, which generate HQL queries, and a resultSet-based report generation tool, which accepts only native SQL queries. It would be good to ... |
34. How to disable native SQL or how to control privileges? forum.hibernate.orgFirst of all, is there a way to disable any native SQL code? In particular, I don't want to be able to do session.createSQLQuery("DROP TABLE tablename"). Also, I want to control the select/insert/update/delete privileges that a hibernate session exposes. For example, I would like to map a table to an entity class and use this mapping to only read from the ... |
35. Native SQL works on Linux, but not Windows. forum.hibernate.orgI am using Hibernate3 over a Mysql V5 database running under Tomcat V5. I have two tables, both of which have an attribute (column) with the name name. I am driving a native query against the database that joins these two tables and selects both name attributes. I am using createSQLQuerys list method (i.e. List result = sess.createSQLQuery(select .).list();). My select ... |
36. Native SQL usage of the IN-operator? forum.hibernate.org |
37. How to refactor this native sql to HQL/JPAQL? forum.hibernate.orgThis is a valid native query for MSSQL JDBC driver. How can I re-write this as HQL? thx. Code: select er.equipmentRepairId, e.serialNumber, ddv.description, ... |
38. Native sql - rownum range - bug !?? forum.hibernate.orgHi, I have the following set of classes A extends B (joined-subclass in hibernate) the foll query.. select a.*, b.* from B b inner join A a on a.id = b.id query.addEntity("b",B.class); yields the desired result.. however, setting setFirstResult and setMaxRows screws up everything.. Is this a bug or am I doing something wrong? Can anyone please help out with this? ... |
39. Native SQL forum.hibernate.orgHi all, I have some complex queries in my application. I have implemented Hibernate. But since I am a newbie, I have used native sql queries and also HQL wherever possible to fetch data from the database for the complex queries. Does Hibernate cache data for the queries that have been fired using native sql? Regards, Fio |