createSQLQuery « Query « JPA Q&A





1. getting count(*) using createSQLQuery in hibernate?    stackoverflow.com

I have several sql queries that I simply want to fire at the database. I am using hibernate throughout the whole application, so i would prefer to use hibernate to call this ...

2. NHibernate CreateSqlQuery and addEntity    stackoverflow.com

The hibernate manual says this:

String sql = "SELECT ID as {c.id}, NAME as {c.name}, " +
   "BIRTHDATE as {c.birthDate}, MOTHER_ID as {c.mother}, {mother.*} " +

  "FROM ...

3. Hibernate - Traversing createSQLQuery results and reading into approriate object    stackoverflow.com

I am pretty new to Hibernate / Java (JSF 2.0) and I am attempting to call a custom query and read the results into an object that I have created Logins. ...

4. Stale Hibernate createSQLQuery    stackoverflow.com

I have a project that is reading from a shared mysql database. There is a large account object that comes from the session (too large, but that is another story). Problem is ...

6. Problem using createSQLQuery with Oracle 10g query    forum.hibernate.org

Hello: I was hoping someone might point me in a direction. The following query in Oracle returns the 25th to 50th records: select * from (select a.*, ROWNUM rnum from ( select * from program order by id) a where ROWNUM <= 50 ) where rnum >= 25; I need to use createSQLQuery to run this query, so I tried the ...

7. How to use AliasToBeanResultTransformer with createSQLQuery?    forum.hibernate.org

Is there anyway to set the aliases for each column outside of the SQL query string? I still want to be able to use "*" but I already have a file that defines a mapping and I want to iterate over that to define the alias for each column which will then be used corresponding to properties in my bean class. ...

9. createSqlQuery in session interface    forum.hibernate.org

List loanDarList; String darflag="R"; Query q=getSession().createSQLQuery("select loan_dar.loan_account_id,loan_dar.transaction_date,loan_dar.due_date,loan_dar.principal_amount,loan_dar.interest_amount,loan_dar.penal_amount,loan_dar.dar_Flag,loan_dar.current_Due,loan_dar.installment_no,loan_dar.fc_entered_date,loan_dar.prin_balance,loan_dar.int_balance,loan_dar.prin_overdue,loan_dar.penal_overdue from loan_dar left outer join gl_txn_ledger_master on gl_txn_ledger_master.fc_gl_txn_id=loan_dar.gl_txn left outer join gl_txn_ledger_entry on gl_txn_ledger_entry.fc_gl_entry_id=loan_dar.principal_gl_entry and gl_txn_ledger_entry.fc_gl_entry_id=loan_dar.interest_gl_entry and gl_txn_ledger_entry.fc_gl_entry_id=loan_dar.penal_gl_entry left outer join user_table on user_table.fc_user_id=loan_dar.fc_user_id where loan_dar.loan_account_id='"+account+"' and loan_dar.dar_Flag='"+darflag+"' and loan_dar.transaction_date<'"+dueDate+"' "); return q.list(); iam using this query this is executing fine in postgre console but this code is not working





10. createSQLQuery problem    forum.hibernate.org

Hi everyone, I have an application that runs queries. A sample query that is giving problem is as follows: Code: SELECT flags.name AS operadora, region.name AS regiao, DATE_FORMAT( data_per_region.date, '%M' ) AS mes, (SUM(transactions_fail) + SUM(transactions_success)) AS transacoes FROM data_per_region ...

11. createSQLQuery for queries with large results    forum.hibernate.org

Hello everyone, I'm running Hibernate 3.3.1.GA and noticed that whenever I use createSQLQuery() to run some SQL queries with large results (by large I mean many thousands of rows), the system gets very slow while the query is being executed. I've tried using ScrollableResults, set the cache mode, flush mode, etc, but it didn't help at all. Funny thing is that ...

12. ResultTransformer with createSQLQuery forces no camelCase in    forum.hibernate.org

i have an sql query as follows: Code: List employees = getCurrentSession() .createSQLQuery( "select" ...

13. createSQLQuery troubles    forum.hibernate.org

Any documentation on session.createSQLQuery? I'm finding it beyond my capabilities today. Gets the rs fine but blows up in NullableType.nullSafeGet, name = BID_ALT_SKEY0_. Why is it appending 0_ to the end? Am I suppose to use SQL or HQL in the 1st parm? jeff.boring@siemens.com DRIVER CODE: Code: sess = sf.openSession(); xac = sess.beginTransaction(); Long id = new Long(1); sql = "Select ...

14. createSQLQuery trouble    forum.hibernate.org

Hi there! I'm trying to execute this (i use the arrays because the query i'm actually trying to execute is a lot longer and i cut out most of it, trying to get it to work): List list = hibernateSession.createSQLQuery("select {currentTechnician.*} from tbTechnician as {currentTechnician}" , new String[] {"currentTechnician"} , new Class[] {Technician.class}).list(); and get the following execption: net.sf.hibernate.JDBCException: SQLException occurred: ...

15. createSQLQuery trouble    forum.hibernate.org

Hi there! You probably won't remember, but about a week ago i posted here about a problem i had with createSQLQuery() and joined subclasses. since i couldn't figure out how to do it at all i wrote an sql-statement that does the job and tried to read all objects with session.load(). now it turned out, that that's terribly slow and i'm ...

16. createSQLQuery problems    forum.hibernate.org

I was working with a native query running over DB2 that only returns a composite-id. I am OK with using HQL for this but the query has several complex joins and the underlying tables contain several hundred million rows so control over the statement is likely to be necessary. I also wanted to see how native queries work. When I run ...





17. createSQLQuery too buggy.    forum.hibernate.org

Newbie Joined: Wed Oct 22, 2003 3:05 am Posts: 9 I thought Max said somewhere that the sql queries were run straight through.. if this is so, i don't understand why this simple query below comes out to be such a complicated one (which is exactly like when i do it in HQL translated to sql) The sql query after you ...

18. createSQLQuery and ?    forum.hibernate.org

Hi Right now I am doing the following in Hql: String hqlquery ="select ms from ms in class com... where id

19. createSQLQuery() and update, table names    forum.hibernate.org

1. Is it at all possible to do an "update" using the same syntax as you would use with session.createSQLQuery()? 2. The examples in the documentation say things like "SELECT {cat.*} FROM CAT AS {cat} WHERE ROWNUM<10" Notice that the name of the table, "CAT", is hard coded into the query. Is there a way to just give just the class ...

20. Problem using createSQLQuery and SELECT COUNT(*)    forum.hibernate.org

Hi there, Im having a problem with getting native SQL to work with a count query. I get the following error message: net.sf.hibernate.MappingException: No persister for: java.lang.Integer The method causing the problem is this ultimately this one: createSQLQuery(getCountQuery(), "a", Integer.class); I then have some more code which is supposed to make use of the number (returned as an Integer) returned from ...

21. Prepared Statement and session.createSqlQuery()    forum.hibernate.org

22. problem whith session.createSQLQuery() method    forum.hibernate.org

23. createSQLQuery question    forum.hibernate.org

Hi! I have the following statement: "select {user}.userID as {user.userId} from tuser {user},tglobaluser_role {gur}, trole {role} where {role}.roleid={gur}.roleid and {role}.name=:roleName and {user}.userID={gur}.userID" After calling query.list() i've got: java.sql.SQLException: Column 'GlobalUs1_1_' not found. at com.mysql.jdbc.ResultSet.findColumn(ResultSet.java:2324) at com.mysql.jdbc.ResultSet.getLong(ResultSet.java:1381) at net.sf.hibernate.type.LongType.get(LongType.java:18) at net.sf.hibernate.type.NullableType.nullSafeGet(NullableType.java:62) at net.sf.hibernate.type.NullableType.nullSafeGet(NullableType.java:53) at net.sf.hibernate.loader.Loader.getKeyFromResultSet(Loader.java:352) at net.sf.hibernate.loader.Loader.doQuery(Loader.java:203) at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:133) at net.sf.hibernate.loader.Loader.doList(Loader.java:950) at net.sf.hibernate.loader.Loader.list(Loader.java:941) at net.sf.hibernate.loader.SQLLoader.list(SQLLoader.java:92) at net.sf.hibernate.impl.SessionImpl.findBySQL(SessionImpl.java:3764) at net.sf.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:52) at ifx.cim.backend.facade.hibernate.BackendServicesImpl.findUsersByRole(BackendServicesImpl.java:255) How ...

24. 'select count()' and createSQLQuery    forum.hibernate.org

How can I use a 'select count(*) ' syntax with Hibernate, since my counting records expression is spanning on multiple tables? I must say that the counting expression cannot be created only by using hibernate mappings, so is needed a call for a native sql with "createSQLQuery" method. Many thanks , Florin Marcus

25. Regarding createSQLQuery function    forum.hibernate.org

Hello- Can somebody provide me with examples of createSQLQuery function. I am trying to convert an SQL query, which joins multiple tables, to Hibernate query using createSQLQuery(,,).list() and am getting errors at runtime. The error message and the java code is placed below. I must be making some mistakes in creating the query. Sample Java code might help me. I will ...

26. Problem with createSQLQuery    forum.hibernate.org

I'm using Hibernate 2.1.2. NOTE: The query presented is very simplified for reading purposes. I want to make a complex query using createSQLQuery because I can't make it work in plain HQL. With the more complex query I get the same error below. Here's my mapping file: MpRequisicaoSq044 Code:

27. CreateSQLQuery not getting the results from multiple tables    forum.hibernate.org

delpouve wrote: have read twice the doc about sql query? Sorry, i didnot post the entire query. the query is createSQLQuery("select {cvo}.customeridvc,{cvo}.customernamevc,{cvo}.shortnamevc,{cvo}.creditstatusvc,{cgvo}.groupnamevc from customer as {cvo} left outer join customergroup as {cgvo} on cgvo.custgroupidvc=cgvo.custgroupidvc"); I need to get the data from both the tables customer and customer group. No where in the hibernate reference an example is given to get the ...

28. Weird Invalid Column Name error while using CreateSQlQuery    forum.hibernate.org

Hi, The same query runs fine on SQL editor but not via hibernate. It always throws be Invalid column name on the joins. I tired using ordinary joins with just putting = but still not working. Any ideas? Code: Query q = sess.createSQLQuery( "SELECT * from STRENGTH_WORKOUT {A} join STRENGTH_ACTIVITY {B} on A.Workout_nr = B.workout_nr" + " JOIN STRENGTH_SET {C} ON ...

29. createSQLQuery vs HQL    forum.hibernate.org

Hi, In my project we're in the process of structuring database access logic. We've decided to try and incorporate SQL (as opposed to HQL) as our primary query language (using createSQLQuery), and thus would like to be as consistent with this as possible. The main arguments for doing this is: * consistent, uniform code * reuse of existing SQL * readability ...

30. createSQLQuery returns invalid column name    forum.hibernate.org

I have the following simple code: String sql = "SELECT {unit}.PICK_CODE AS {unit.pickCode} FROM UNIT {unit}"; List resorts = session.createSQLQuery(sql, "unit", Unit.class).list(); My UNIT table has 3 columns: ID PICK_CODE FLOOR_NAME My Unit.hbm.xml is correct as well as the Unit.class, because when I run the above SQL with {unit.*}, it works just fine. But I only want to return the one ...

31. Problem trying to debug createSQLQuery() calls...    forum.hibernate.org

String query = "SELECT cle.observed_time as {cle.observedTime} FROM ul_common_log_event {cle}"; public List find(String query) { Session session = null; List result = null; try { ...

32. How to use COUNT in method createSqlQuery ??    forum.hibernate.org

33. No persister for error with createSQLQuery    forum.hibernate.org

Code: String qry = "select livro.cd_livro as {r.codigoLivro}, " + " livro.nm_livro as {r.nomeLivro}, " + ...

34. tuple order (named SQL queries vs. createSQLQuery)    forum.hibernate.org

Newbie Joined: Wed Nov 03, 2004 4:40 pm Posts: 4 Newbie here so I hope this makes sense. I have been refactoring some Hibernate SQL queries out of Java code into named SQL queries into my Hibernate mapping file. I noticed when I ran the exact same SQL that returns a tuple of three objects, I was getting the objects in ...

35. problem using createSQLQuery()    forum.hibernate.org

36. Escaping colons : using createSQLQuery in hibernate 3.0    forum.hibernate.org

Has the issue of escaping the colon character been resolved? I am using Eclipse SDK Version: 3.2.0 Build id: M20060629-1905 The SQLQuery statement for a native MSSQL 2005 I am trying to use is: select top 10 MyTable.GUID as GUID0_ where MyTable.myDate < cast('2007/11/08 01:24:35' as datetime) The Hibernate 3.2.0 translate it into: select top 10 MyTable.GUID as GUID0_ where MyTable.myDate ...

37. createSQLQuery sent me HibernateQueryException    forum.hibernate.org

Hi folks! Help me if you can! I used createSQLQuery tring a count(*) from a teble but it sent me a HibernateQueryException: org.springframework.orm.hibernate.HibernateQueryException: Alias [L] does not correspond to any of the supplied return aliases = {[{L}]} [ SELECT {L.*} FROM LOG {L} WHERE MATCH({L}.SEVERIDADE,{L}.PALAVRAS_CHAVE,{L}.MENSAGEM_CURTA) AGAINST('WARN + ' ' + contestado , cobilling') AND {L}.DATA BETWEEN '2005-01-01' AND '2005-02-02']; nested exception ...

38. createSQLQUery returns Invalidcolumn name    forum.hibernate.org

Need help with Hibernate? Read this first: http://www.hibernate.org/ForumMailingli ... AskForHelp [a] prom desciption I am tryign to try out createSQLQuery to access a colum from database. I get invalid columname sql error. I am not sure what's going worng here. i wrote a simple query to get uowstatus value form unitofwork table. i mapped the hibernate column name. session.createSQLQury(select uow.uowstatus as ...

39. createSQLQuery has no effect    forum.hibernate.org

40. hibernate2 createSQLQuery    forum.hibernate.org

41. CreateSQLQuery StringIndexOutOfBoundsException    forum.hibernate.org

Attempting to use CreateSQLQuery with SQL code beginning with capitalized SELECT, throws StringIndexOutOfBoundsException. In the code for the method: public String getLimitString(String sql, boolean hasOffset) { int startOfSelect = sql.indexOf("select"); StringBuffer pagingSelect = new StringBuffer( sql.length()+100 ) .append( sql.substring(0, startOfSelect) ) //add the comment //nest the main query in an outer select .append("select * from ( select ") //add the rownnumber ...

42. Basic createSQLQuery question    forum.hibernate.org

43. Escaping colons using createSQLQuery in Hibernate 3 (again)    forum.hibernate.org

String sql = "select cat.originalId as {cat.id}, " + "cat.mateid as {cat.mate}, cat.sex as {cat.sex}, " + "cat.weight*10 as {cat.weight}, cat.name as {cat.name} " + "'2005-6-28 13:54:12' AS {cat.date}" + "from cat_log cat where {cat.mate} = :catId"

44. hai iam using hibernate.createSqlQUERY()    forum.hibernate.org

45. NoSuchMethodError Exception on CreateSqlQuery Call    forum.hibernate.org

Newbie Joined: Tue Jul 26, 2005 10:05 pm Posts: 1 I'm receiving a 'NoSuchMethodError' exception when I use the CreateSqlQuery Session Method. The same code work in windows on the same version of Tomcat (4.0), but fails on unix machine. class, config and mapping files are in the same directories. Hibernate version: 3.0.5 Mapping documents: Code between sessionFactory.openSession() and session.close(): Full ...

46. SQL Union in createSQLQuery    forum.hibernate.org

Hello this is the output... The strange about is that a time ago I tried the same SQL and it didn't bring me any error but the table was empty. Now that I add some data to one table the error comes back again. Code: Hibernate: SELECT t.id as id0_, t.name as name0_0_ FROM test t UNION SELECT n.id as id1_, ...

47. Question about using of CreateSQLQuery with scalar values    forum.hibernate.org

hi, I am using Hibernate 2.1.7 with DB2 UDB. I need to execute a SQL Query (in order to use sql functions like COALESCE or CASE ... WHEN .. THEN). So I tried to use the CreateSQLQuery() statement like this requete = new StringBuffer() .append(" select ") .append(" {declaca0.*} ") .append(" from DECLAFOU.DECLACA {declaca0} ") .append(" where {declaca0}.AACC_NUMERO='1' "); Query quer ...

48. distinct in createSQLQuery    forum.hibernate.org

49. createSQLQuery error    forum.hibernate.org

Im getting grey hair.... Hibernate version: 3.0 Hi, I have a problem using a simple createSQLQuery method in a dao class that extendes HibernateDaoSupport. I can see its complaining about my id column in my Ad class. the id variable is a String as you can see in my hib-mapping doc below but this should not be a problem.... The code ...

50. Can parameterize table name in "createSQLQuery"?    forum.hibernate.org

51. createSQLQuery question about colons and times    forum.hibernate.org

Iterator i = session.createSQLQuery("SELECT " + " TO_CHAR (rcpt_date, :datetimePattern) received," + " TO_CHAR (rlsd_date, :datetimePattern) released," + " TO_CHAR (shpd_date, :datetimePattern) shipped" + " FROM aTable" + " WHERE documentNumber LIKE " + 'SOMETHINGOROTHER%'") .setString("datetimePattern", "mm/dd/yyyy hh24:mi:ss") .addScalar("RECEIVED", Hibernate.STRING) .addScalar("RELEASED", Hibernate.STRING) .addScalar("SHIPPED", ...

52. createSQLQuery Question    forum.hibernate.org

max wrote: so provide a patch if it is important for you ;) The migration guide specificly mentions the classic interface. The docs in svn is uptodate - I would like to receive bugreports to that since it is basically a rewrite. I'm not migrating old code to a newer version of Hibernate so why would I look at a migration ...

53. problem with createSQLQuery    forum.hibernate.org

Hibernate version: 3.0 I am trying to get the following query to work: Session session = HibernateAbstractSessionUtil.getCurrentSession(); Double query = (Double) session.createSQLQuery( "SELECT SUM(postAmount) sumPostAmount " + " FROM ( SELECT (CASE WHEN ENTRY_TYPE = 'DEBIT' THEN POST_AMOUNT ELSE POST_AMOUNT * -1 END) postAmount " + " from S_GL_ENTRY_E11 ) e11") .addScalar("sumPostAmount", Hibernate.DOUBLE) .addScalar("postAmount", Hibernate.DOUBLE) .uniqueResult(); sumOfPostAmounts = query.doubleValue(); The query ...

54. problem with createSQLQuery    forum.hibernate.org

Hibernate version: 3.0 I am trying to get the following query to work: Session session = HibernateAbstractSessionUtil.getCurrentSession(); Double query = (Double) session.createSQLQuery( "SELECT SUM(postAmount) sumPostAmount " + " FROM ( SELECT (CASE WHEN ENTRY_TYPE = 'DEBIT' THEN POST_AMOUNT ELSE POST_AMOUNT * -1 END) postAmount " + " from S_GL_ENTRY_E11 ) e11") .addScalar("sumPostAmount", Hibernate.DOUBLE) .addScalar("postAmount", Hibernate.DOUBLE) .uniqueResult(); sumOfPostAmounts = query.doubleValue(); The query ...

55. Help with createSQLQuery    forum.hibernate.org

56. Help Required for createSQLQuery()    forum.hibernate.org

Hi.. I am trying to reteive columns for diffent tables within an SQL query. For example: Let EMPLOYEE, DEPT are two tables. My Query is as follows: select emp.empID, dept.deptID from EMPLOYEE emp join DEPT dep on emp.deptID = dep.deptID how should my createSQLQuery should be and once i get my list how can I retrieve empId and deptId. Thanks & ...

57. Hibernate : using MINUS in createSQLQuery - Reply this mail    forum.hibernate.org

Need help with Hibernate? Read this first: http://www.hibernate.org/ForumMailingli ... AskForHelp [b]Hibernate version:3.0[/b] [b]Mapping documents: oracle.jdbc.driver.OracleDriver jdbc:oracle:thin:@XXXX:project scott tiger 10 true org.hibernate.dialect.Oracle9Dialect update [/b] [b] Session session = factory.openSession(); Transaction txShow = session.beginTransaction(); player p1=new player(); String query2 = " SELECT {t1}.ID as {t1.id} , {t1}.NAME ...

58. Hibernate : using MINUS in createSQLQuery    forum.hibernate.org

Need help with Hibernate? Read this first: http://www.hibernate.org/ForumMailingli ... AskForHelp [b]Hibernate version:3.0[/b] [b]Mapping documents: oracle.jdbc.driver.OracleDriver jdbc:oracle:thin:@XXXX:project scott tiger 10 true org.hibernate.dialect.Oracle9Dialect update [/b] [b] Session session = factory.openSession(); Transaction txShow = session.beginTransaction(); player p1=new player(); String query2 = " SELECT {t1}.ID as {t1.id} , {t1}.NAME ...

59. Problem using createSQLQuery/creating native SQL    forum.hibernate.org

Hibernate version: 2.1.7 Full stack trace of any exception that occurs: 10:27:06,756 WARN JDBCExceptionReporter:57 - SQL Error: 0, SQLState: 42703 10:27:06,756 ERROR JDBCExceptionReporter:58 - The column name id0_ was not found in this ResultSet. 10:27:06,787 WARN JDBCExceptionReporter:57 - SQL Error: 0, SQLState: 42703 10:27:06,787 ERROR JDBCExceptionReporter:58 - The column name id0_ was not found in this ResultSet. net.sf.hibernate.exception.SQLGrammarException: error performing findBySQL ...

60. createSQLQuery in H3.2    forum.hibernate.org

The old way of doing native sql has been deprecated. I see the new functions available at createSQLQuery(). but it does not seem very practical to use with pre-existing sql. I have a lot of existing sql and would like to use it. It also has variable inputs designated with a prefixed colon. My question is: Can i still use the ...

61. Strange createSQLQuery() method behaviour    forum.hibernate.org

Hello, I'm newcomer of this forum. And I think You can give me advise about problem below. Thanks in advance! Best regards, Alex Hibernate version: 3.2 Mapping documents: I have annotated Java class: @Entity @Table(name = "TEST", uniqueConstraints = {}) public class Test { //////////////////////////////////////////////// // Fields //////////////////////////////////////////////// private Integer id; private Integer klasse; private Integer parentId; /////////////////////////////////////////////////////// // Constructors /////////////////////////////////////////////////////// ...

62. Strange createSQLQuery() method behaviour    forum.hibernate.org

Hello, I'm newcomer of this forum. And I think You can give me advise about problem below. Thanks in advance! Best regards, Alex Hibernate version: 3.2 Mapping documents: I have annotated Java class: @Entity @Table(name = "TEST", uniqueConstraints = {}) public class Test { //////////////////////////////////////////////// // Fields //////////////////////////////////////////////// private Integer id; private Integer klasse; private Integer parentId; /////////////////////////////////////////////////////// // Constructors /////////////////////////////////////////////////////// ...

63. Can i use createSQLQuery to execute native sql updates as we    forum.hibernate.org

max wrote: you should use in named queries to specify which tables needs flushing. No. It's recently added in Hibernate 3.2 svn Is the block present since the 3.0 ? If yes, just try and use it. BTW, max, is there somewhere to find a doc for this feature ? I'm trying to test it with 3.2.1.ga, but can't ...

64. createSQLQuery problems    forum.hibernate.org

I'm having problems getting the createSQLQuery to work with my tables. I have a country table, a state table and a country to state table that maps states to countries (many-to-many). What I'm trying to do is load all the country objects into memory with all their state collections without using eager fetching because I want to avoid a cartesian product. ...

65. mysql an createSqlQuery    forum.hibernate.org

Environment: MySql 5.0.22-community-nt Hibernate 3.1.3 Hello, this native SQL-Query: select s.internetsuche_id, e.inetsuchergebnis_id, s.bezeichnung, s.datum, e.datum, count(es.inetsuchergseite_id), s.queryparameter from internetsuche s left outer join inetsuchergebnis e on s.internetsuche_id = e.internetsuche_id left outer join inetsuchergseite es on e.inetsuchergebnis_id = es.inetsuchergebnis_id group by e.inetsuchergebnis_id order by s.internetsuche_id, s.datum, e.datum; results in e.datum set to s.datum in every row. Code: (Breakpoint at createSQLQuery) private List ...

66. Hibernate createSQLQuery Help    forum.hibernate.org

Below is a SQL statement that works anywhere except when I use it through hibernate. Can anyone see anything that I am doing wrong or any suggestions. Call: (Double) getSession().createSQLQuery(AVG_DAILY_FILE_SIZE).uniqueResult(); Hibernate: /* dynamic native SQL query */ select avg(avg_daily_file_size / (select count(distinct date) from Issue i, File f where i.issue_id = f.issue_id)) as total from (select sum(f.file_size) as avg_daily_file_size from Issue ...

67. createSQLQuery    forum.hibernate.org

List list = session.createSQLQuery("SELECT * from (SELECT {c.*} FROM customers c) AS customers, (SELECT {a.*} FROM account a) AS account") .addEntity("c", Customer.class) .addEntity("a", Account.class) .list();

68. createSQLQuery exception:    forum.hibernate.org

69. Length of char attr's lost: sess.createSQLQuery("...&qu    forum.hibernate.org

session.createSQLQuery("select......").list() appears to truncate char attributes to a single character. Is this a known issue? If a bug, are there generic workarounds? I have to do a fair amount of bulk dml, sometimes on tables unknown to hibernate, and this bug can be a real stumbling block. I'm using Hibernate 3.2.2, here's all the relevant log data: - Hibernate 3.2.2 - ...

70. createSqlQuery with t.a1, t.a2, ... works, but {t.*} doesn't    forum.hibernate.org

The essence of my problem is this: Using createSqlQuery to query for a complete list of table attributes (i.e table.attribute1, table.attribute2, ...) works, but replacing the list with {table.*} causes an exception. In the java classes used for the below queries, Subscription inherits Product. Also, notice that the generated alias s_1_ in the Hibernate query is never actually mapped by Hibernate. ...

71. Wrong Query Output by createSQLQuery    forum.hibernate.org

Hi, I have a mytable whose columns in hbm are defined as below Table Data name age John 10 Peter 20 I want run simple query as select sum(age), count(name) from mytable the output at database end is 30, 2 Problem is when i try to execute same query using createSQLQuery of hibernate ...

72. update using createSQLQuery problem    forum.hibernate.org

Hi everyone, i am having a problem updating my database, below are my codes: my mapping: Code:

73. Problems with createSQLQuery    forum.hibernate.org

74. createSQLQuery and escaping a colon    forum.hibernate.org

Hi All, I have a query which calculates averages over sets of records (10 per set, in this example) against MySQL. This requires an embedded colon: select floor((@x := @x + 1) / 10), avg(column1) from ... where ... group by 1; but the := causes the 'Not all named parameters have been set' exception. I cannot use the suggested 'replace ...

75. Problem with createSQLQuery and sum(x*y)    forum.hibernate.org

76. How to get table column info when using createSQLQuery    forum.hibernate.org

Hello: Pardon me if it has been answered before but I could not find via different searches on Hibernate or Google. createSQLQuery("select * from A,B where ").iterate() to get earch row and do processing. the doc says the above returns Object[], which is great except that I need to know their column names, which it would not be practically to use ...

77. create native sql query using union by createsqlquery interf    forum.hibernate.org

how form below native sql query into session.createsqlquery() SELECT STRMEDMAST.OU_CODE, SRC_PHACODE , STRMEDMAST.SRD_DATE, STRMEDMAST.SR_NO, STRMEDMAST.SRC_SLNO, STRMEDMAST.SRC_REQUEST ,''ch, 'Y' typ,'N' print FROM STRMEDMAST where nvl( STRMEDMAST.SRC_CANCEL, 'N')='N' and nvl(STRMEDMAST.SRC_CLOSE,'N')<>'Y' and STRMEDMAST.src_reqto='P' and SRC_PHACODE = :r_code and 'A'= :all_a UNION ALL SELECT PATDRGREQMST.ou_CODE, patient.PT_NO, PATDRGREQMST.DRD_DATE, patient.PT_NO, PATDRGREQMST.DR_SLNO, patient.PTC_PTNAME,'','N',print FROM PATDRGREQMST, patient WHERE ( PATDRGREQMST.PT_NO = patient.PT_NO) and ( PATDRGREQMST.BMC_SLNO IS NULL) AND PATDRGREQMST.DRC_CANCEL ...

78. Oracle, Derby and createSQLQuery( )    forum.hibernate.org

Newbie Joined: Fri Jun 20, 2008 2:04 pm Posts: 3 I wrote some code for Oracle that worked great. I was then asked to support the embedded Derby database using the same code. One inconsistent behavior I noticed is the Oracle driver returns a String object from a query while the Derby driver returns Character object. In a regular JDBC program, ...

79. Hibernate 2 - help with session.createSQLQuery    forum.hibernate.org

80. How call oracle function using session.createSQLQuery    forum.hibernate.org

Hello, I need call an oracle sql function that has this header: CREATE OR REPLACE PACKAGE ARMADO.COP IS FUNCTION FNC_SECUENCIA( NUM_CONCESIONARIA IN NUMBER , NOMBRE_SECUENCIA IN VARCHAR2) RETURN NUMBER ; END; I have this in my java code: try { SessionFactory sessionFactory = HibernateUtil.getSessionFactory(); session = sessionFactory.openSession(); session.beginTransaction(); int result = session.createSQLQuery("{ ? = call ARMADO.COP.FNC_SECUENCIA(?,?)}") .setParameter(0,3) .setParameter(1,"NUM_CORR_VIAJE") .executeUpdate(); } catch(Exception ...