SQLquery « Database « JPA Q&A





1. hibernate SQLquery extract variable    stackoverflow.com

How can I extract variables total, min, max from hibernate SQL queries and assign them to java variables?

(select count(*) as total, min(price) as min, max(price) as max from product).addScalar("total", Hibernate.INTEGER).addScalar("min", ...

2. AliasToBeanResultTransformer and Hibernate SQLQuery    stackoverflow.com

I have a rather complex query (too many nested levels for either HQL or Criteria queries), so I've written it as a SQLQuery. I'd really like to use the AliasToBeanResultTransformer ...

3. How to convert from hibernate SQLQuery result to JSON    stackoverflow.com

I have a problem, I'm trying to convert an SQLQuery object result (from Hibernate) to a JSON.

   SQLQuery q = session.createSQLQuery("SELECT * FROM table");
   List<javaBean> list = ...

4. When to go for SQLQuery in hibernate    coderanch.com

5. Problem org.hibernate.type.NullableType nullSafe in SQLQuery    forum.hibernate.org

Hello I've this simple query that I've to do in native SQL: Code: SQLQuery query = sess.createSQLQuery("SELECT * from " + table + " WHERE " + filter + " LIKE '" + search + "%'"); System.out.println(query.toString()); List result = query.list(); so there is no mapping. It works most of the times. The problem is when I use a certain table ...

6. I must be missing something on Creating this SQLQuery.    forum.hibernate.org

Ok, so I am trying to make a simple sql query. Hence the reason I think this is a really stupid question. For some reason, I'm getting an invalid column name SQLException. Only problem is that all of the columns are correct and I can see data coming back in the log. Not sure what is going on. If I do ...

7. Problem running SQLQuery with Hibernate 3.05    forum.hibernate.org

Hi, I am having a problem executing an SQLQuery, with Hibernate 3.05. This is a (simplified) code fragment that exhibits the problem: String SQL = "SELECT RN, TASK_ID AS {UT.TASK_ID}, USER_ID AS {UT.USER_ID}, EVENT_GROUP AS {UT.EVENT_GROUP} FROM (SELECT ROW_NUMBER() OVER (ORDER BY T.COMPLETION_DT) AS RN, T.TASK_ID AS TASK_ID, T.USER_ID AS USER_ID, E.EVENT_GROUP AS EVENT_GROUP FROM USER_TASKS T, EVENT E WHERE E.EVENT_ID=T.EVENT_ID) ...

8. How do you execute a SQLQuery?    forum.hibernate.org

Hibernate version: 3 I'm trying to execute an SQLQuery: Code: SQLQuery q = HibernateUtil.getSession().createSQLQuery( "select * from NBWA_business as business WHERE TO_DAYS(expirationDate) > TO_DAYS(:date)" ); q.setDate("date",getDate()); q.addEntity("business",Business.class); System.out.println( ...

9. AddJoin doesn't work with SQLQuery    forum.hibernate.org





10. SQLQuery Problem - To Long to Execute    forum.hibernate.org

Newbie Joined: Tue Dec 27, 2005 7:34 am Posts: 4 Hibernate Version: 3.0.5 Database: MSSQL Server 2000 JDBC Driver: 2.2.0.0.40 Microsoft SQLServer 2000 Driver for JDBC The following sql-query takes to many time to execute in hibernate(10 to 15 minutes): SELECT S.SKU_PART_NUMBER, S.SKU_ID, A.ACTIVITY_NAME, D.DATA_LABEL, D.DATA_ID, SD.DATA_VALUE, D.DATA_IS_PARAMETER, upper(P.PARAMETER_VALUE) as PARAMETER_VALUE, DT.DATA_TYPE_DESCRIPTION, S.FLOW_ID FROM PDM_DATA AS D INNER JOIN PDM_DATA_PDM_PLUGIN DP ...

11. org.hibernate.impl.SQLQuery.iterate not implemented    forum.hibernate.org

Need help with Hibernate? Read this first: http://www.hibernate.org/ForumMailingli ... AskForHelp Hibernate version: 3.1 Mapping documents: Code between sessionFactory.openSession() and session.close(): I have a named query that works just fine, so I haven't included it. The query is run against a SQLServer db. I would like to iterate over the results, so I wrapped my ScrollableResults with an iterator. Is there some ...

12. retrieving results in SQLQuery from Hibernate    forum.hibernate.org

Hi All I am new to Hibernate. I am using Hibernate3.jar & Oracle9i database. This is the query i have which i need to run using Hibernate **************************************** select a.id ,a.number ,ag.name ,s.title ,gp.ptitle ,(select sum(nvl(rs.amount,0)) from rights ,rights_ext where rights.id (+)= a.id and rights.rights_ext_id (+)= right_ext.ser_id) amount ,a.status_id, p.name from a , ap ,gp ,sa ,s ,ag ,apr, p where ...

13. SQLQuery Help !    forum.hibernate.org

Hi, I am new to Hibernate and I have a question about mapping specific columns to a bean. I have a SQL query that joins to 2 tables. I am only retrieving a limited number of the columns from each table. What would be the best/easiest way to populate a single java bean with the columns from both tables ? Thanks ...

14. Cannot get SQLQuery to work.    forum.hibernate.org

Query sqlQuery = session.createSQLQuery( "select " + "{p}.realId as {p.id} " + "{p}.isDeleted as {p.isDeleted} " + ...

15. SqlQuery and variables    forum.hibernate.org

I have still not had any success finding any details about this. I have tried a number of sequences that I have found in examples such as a / or enclosing it in {} but neither works. Surely it must be possible to use a : in a statement? Also when I use addJoin() the result of .list() becomes an array, ...

16. addScalar and addEntity in SQLQuery differ for Linux and Win    forum.hibernate.org

Hi all. I'm using Hibernate 3.0.5, Oracle 10g. I'm having trouble reading results from list returned by SQLQuery.list(). The code is: Code: query.addEntity("sa", ServiceAgreement.class) .addScalar("status_hour", Hibernate.LONG) .addScalar("status_day", Hibernate.LONG) ...





17. Problem with sqlQuery & hqlQuery    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 ...

18. cancelQuery and SQLQuery.setTimeout()    forum.hibernate.org

I have a couple of simple questions hopefully someone can clear up my confusion. 1. I have an SQLQuery object which I have setTimeout(5). Instead of timeout at 5 seconds, it printed a message at 5 minutes 2007.10.24 16:01:53,399 WARN [TransactionImpl] Transaction TransactionImpl:XidImpl[FormatId=257, GlobalId=null:1193265661772/37, BranchQual=null:1193265661772, localId=0:37] timed out. status=STATUS_ACTIVE However, the query does not terminate. The query is pretty simple, just ...

19. SQLQuery metadata    forum.hibernate.org

20. Problems with using Pre*EventListener and SQLQuery    forum.hibernate.org

Good time. I have some problems with using Pre*EventListener and SQLQuery. Problem 1 : If in the PreUpdateEventListener create insert into db usage SQLQuery, hibbernate generate exception. Table nodeproperty_annotation_history don`t have mapping, and using only through JDBC(please see "Code") 1.1 Code @Transactional public Oblect createCommand(){ ..... hibernateSupport.saveOrUpdate(command); ..... } ...... public boolean onPreUpdate(PreUpdateEvent p_event) { String sql ="INSERT INTO nodeproperty_annotation_history( value, ...

21. ClassCastException with SQLQuery and setCacheable(true)    forum.hibernate.org

Caused by: java.lang.ClassCastException: java.lang.Integer at org.hibernate.cache.StandardQueryCache.put(StandardQueryCache.java:83) at org.hibernate.loader.Loader.putResultInQueryCache(Loader.java:2187) at org.hibernate.loader.Loader.listUsingQueryCache(Loader.java:2138) at org.hibernate.loader.Loader.list(Loader.java:2096) at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:289) at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1697) at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:142) at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:152) at org.hibernate.impl.AbstractQueryImpl.uniqueResult(AbstractQueryImpl.java:811) at myClass.myMethod(MyClass.java:53)

22. Getting Metadata from SQLQuery in hibernate    forum.hibernate.org

23. typecasting in SQLQuery with PostgreSQL    forum.hibernate.org

24. Why don u support getReturnAliases() for SQLQuery    forum.hibernate.org

Hi to every one, I am trying to execute native sql query with the help of createSQLQuery(). Then i want those select clause fields alias names to display in my GUI. Still i am getting the unsupportedoperation exception. why don u support return alias for sql queries? is there any purpose or any trouble? Please give me an alternate solution to ...