hql 1 « HQL « JPA Q&A





1. Grouping in hibernate - stupid question    stackoverflow.com

I'm in process of migrating an old "classic ASP" application to J2EE/Hibernate. I have a problem with the following type of SQL statements:

SELECT parent.id, parent.name, parent.column1, count(child.id) AS no_of_children
FROM parent
INNER ...

2. HQL Problem    stackoverflow.com

Hi every one I have these classe

@Entity
@Table(name = "login", uniqueConstraints={@UniqueConstraint(columnNames={"username_fk"})})
public class Login implements Serializable {

    @Id
    @Column(name = "id")
    @GeneratedValue
   ...

3. hibernate hql getMaxVersion    stackoverflow.com

I have a table with the following structure:

ReportId
Version
Title
.....
I want to use HQL to fetch the newest version of the report by id. Would ...

4. Abnormal behaviour by HQL while using JPA (*** More of an information to readers than a question *** )    stackoverflow.com

I was trying to fire hql for some reporting purpose in my JPA based application. The following query that I tried kept conking out on startup (Since I had given it as ...

5. "where exists" in Hibernate HQL    stackoverflow.com

How can I write a "not exists" query in HQL? I am trying to get an HQL not exists query which returns the same results as this Oracle SQL query:

select *
from ...

6. Hibernate Execption    stackoverflow.com

i want to try to find out all the fieldValue based on fieldName MNC.java:

`private Map <String, String>formFields = new HashMap<String, String>();

public void setFieldValue(String fieldName, String fieldValue) {
      ...

7. hibernate question    stackoverflow.com

if i use table name instead of class name in HQL query like this:

  select classname.field name as obj from table name
and i have specified mapping in hbm file. but ...

8. how to retrive age using a specific DOB via HQL    stackoverflow.com

please help me, i want to find out the day difference in dob and current date, pls tell me a good HQL for that

9. Add Criterions and Orders to HQL    stackoverflow.com

Is it possible to add Criterions and Orders to an HQL statement? For example, given HQL

from Category c where c.name like 'Laptop%'
Can I add the following?
Order.asc("name")
Restrictions.eq("enabled", "Y")
The reason for this awkward design ...





10. Hibernate SetParameter driving me nuts    stackoverflow.com

This works

hql = "from State where StateCode like 'T%'";
Query query = session.createQuery(hql);
This does not
hql = "from State where StateCode like :StateCode";
Query query = session.createQuery(hql);
query.setParameter("StateCode", "T%");
I get this
1568 [main] DEBUG org.hibernate.hql.ast.ErrorCounter  ...

11. Day of year in HQL?    stackoverflow.com

Is there any way to extract the day of year (1-366) from a date in HQL? Is the only option to extend the dialects I need and explicitly register the functions? ...

12. org.hibernate.HibernateException: could not instantiate QueryTranslatorFactory: org.hibernate.hql.classic.ClassicQueryTransactionFactory    stackoverflow.com

why this exception is occure when i run query from hql editor

org.hibernate.HibernateException: could not instantiate QueryTranslatorFactory: org.hibernate.hql.classic.ClassicQueryTransactionFactory
    at org.hibernate.cfg.SettingsFactory.createQueryTranslatorFactory(SettingsFactory.java:391)
    at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:222)
    at ...

13. Using Apache Hive as a MapReduce Input Format and/or Scraping Hive Metadata    stackoverflow.com

Our environment is heavy into storing data in hive. I find myself currently working on something that it outside the scope though. I have a mapreduce written, but it requires a ...

14. How to escape reserved words in Hibernate's HQL    stackoverflow.com

I use the following query to get a java.util.Map with indexes id, text and object:

Query q = mySession.createQuery(
    "SELECT u.id AS id, u.name AS text, u AS object ...

15. hibernate hql different between WITH and WHERE    stackoverflow.com

Hi guys: Im just studying about HQL Could anyone explain or provide some links about different between WITH and WHERE in HQL? fromhttp://docs.jboss.org/hibernate/core/3.3/reference/en/html/queryhql.html example like:

from Cat as cat ...

16. Warning: java.lang.IndexOutOfBoundsException    stackoverflow.com

when calling the following function I get an error. The HQL query functions downloading data from the database, but unfortunately I get an error:

java.lang.IndexOutOfBoundsException: Index: 1, Size: 0
    ...





17. Java HQL tree display    stackoverflow.com

I have a class named Rule, which contains a Set of childRules(each of the components of the Set are other classes). I am doing a HQL query which is marked as ...

18. HQL can't handle parentheses after FROM    stackoverflow.com

I'm trying to count the rows of a complicated call I have, such as ...

SELECT COUNT(*) FROM ( SELECT *my complicated HQL table request here* )
Unfortunately hibernate parser complains about the ...

19. hql    forums.netbeans.org

i tyr to implement hql on netbeans ..i faced followin prolm '' javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an ...

20. HQL Doubt    coderanch.com

21. hql problem    coderanch.com

Hi yogesh Here is an example and think this should clear your doubt:-- The example is as follows public MessageDataBO addOutgoingMessage(MessageDataBO msgData) { Session session=null; int arr_cnt = 0; try { Configuration config = new Configuration().configure(); config.addClass(MessageDataBO.class); SessionFactory sessionFactory = config.buildSessionFactory(); session = sessionFactory.openSession(); Query query = session.createQuery("from MessageDataBO"); System.err.println("Executing HQL " + query.getQueryString()); try { int count = 0; List ...

22. Advanced hql    coderanch.com

23. HQL Problem    coderanch.com

When my method retrieveOfferList() which does some query through criteria and return result via criteria.list(). But there are 34 HQL statement generated by Hibernate instead of just 1 HQL statement when calling retrieveOfferList () . I guess the reason is as below listed: When calling retrieveOfferList(), Hibernate will firstly build one HQL statatment to get all related Offers, in my test ...

24. HQL    coderanch.com

25. HQL Tutorial?    coderanch.com

26. help on HQL    coderanch.com

I'm peforming the following HQL but get 0 results, but according to database I should get 1 result. Now if I execute the SQL generated by this HQL query I get a result, which is correct. Any ideas why HQL is not working properly? ========================================================== Participant p = (Participant)getHibernateTemplate().execute( new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException { Criteria c ...

27. Hibernate HQL returns partial data?    coderanch.com

Hi All, I am trying to print the values of Members Tables. I am able to print only Name value where as Password value is shown null. --------------------------------- here is the code ------------------------------ List mems =session.createQuery("from Members m order by m.name asc").list(); Iterator iter = mems.iterator(); while (iter.hasNext()) { Members members = (Members)iter.next(); System.out.println("members name is..."+members.getName()); System.out.println("members pswd is..."+members.getPassword()); } ------------------------------ ...

28. Help with HQL    coderanch.com

This is my use case : I need to create an object from two Hibernate mapped classes . ex: class1 : a,b - mapped to a table class2 : c,d - mapped to a table class3: a,c - no mappings I did something like "select new class3(class1.a,class2.c) from class1,class2)" but hibernate is throwing error saying no class like class3. I know ...

29. HQL help!    coderanch.com

I have been stuck on this one and am getting lost in information overload I have 5 tables: A Page has a many-to-many to Header and Header has a many-to-many to Category. So here are how the tables look: Page -- Page_Header -- Header -- Header_Category -- Category. I would like to be able to write an HQL query to load ...

30. HQL doubt.    coderanch.com

You can't do this in a relation database. If you mention more than one table in a sql statement you are doing some sort of join, even if it is the most basic union. So you can't do this in HQL without using a join either. You can make it appear you are not using a join by defining a non-lazy ...

31. HQL    coderanch.com

i am using user table to fetch the user details and role table to fetch the roles and description And we have one more table of user_role_link table in which user_id and role_id is associated in it. user table doesn't have the role_id and role table doesn't have the user_id, based on this i want to write a HQL to fetch ...

32. HQL    coderanch.com

33. Hibernate-Unable to execute the HQL in z/OS    coderanch.com

...

34. Hibernate (HQL) and many-to-many issues    coderanch.com

I am using the "petclinic" app to learn more about Hibernate and Spring MVC (Hibernate3, and Spring 2.5). It works beautifully, and now I'm customizing/extending this app... Simply: I have a USER table (tt_user) and a GROUP table (tt_group), and a USERGROUP many-to-many relationship table (tt_usergroup). I want a list of users that have not yet been added to a given ...

35. with temp in hql?    coderanch.com

36. Point me to a COMPLETE HQL reference?    coderanch.com

Can anyone point me to a COMPLETE HQL reference guide? The Hibernate docs are a little anemic on the specification side of things. They give one or two kindergarten examples, but, for instance, leave out the LIKE operator entirely. Failing this, can anyone tell me how to use the LIKE operator in HQL queries? Is "from MyObject where MyField like :param" ...

37. Help in HQL    coderanch.com

Hi, I am having difficulty creating an HQL statement. The following code is working ICriteria criteria = session.CreateCriteria(typeof (Organization)); criteria.CreateAlias("Addresses", "alist"); criteria.CreateAlias("alist.items", "add"); criteria.Add(Expression.Like("add.State", "U%")); return criteria.List(); but when I want to code the same in HQL I get an error "could not resolve property: items of:". The hql is given below string sql = "from Organization as o join fetch ...

38. HQL    coderanch.com

I agree with Vishal - HQL is only concerned with the domain objects that you have mapped out in your configuration, and operates at a higher level of abstraction. The Hibernate Dialect you have specified (be it mysql or postgres) is used to generate the actual sql that gets executed at runtime.

39. hibernate - hql not working as expected    coderanch.com

hi- see in hibernate when i look at dynamic sql output, the description field is named something else. category0_.ACTION_as col_3_0_ should be category0_.description as col_3_0_ i get the dreaded error 42X04 error. i cant figure it out. i can tell you that when i stay away from this field name in my hql editor all the hql is ok. any ...

41. How to Profilling HQL?.. (Good Understanding)    coderanch.com

Hi Leonardo, I think this kind of "profiling" test won't give you reliable results. If you run this test against a real database backend there will be many caching effects (database, JPA, file system, OS) and something like this which could lead to very varying results from test run to test run and of course database server to database server. I'm ...

42. Reason for using HQL in Hibernate    coderanch.com

HQL does not refer directly to tables in the database but instead refers to the classes that these tables are mapped to in your hibernate mapping files (or annotations). This means that your code does not need to know anything about the database that it is attached to and this is a good thing. If you decided to port your application ...

43. Hql top    coderanch.com

I know you can perform joins with detatched criteria, but I'm not too acquainted with it. I've mostly used it to dynamically build where clauses. The bit of joining I did I found more complicated than writing the whole HQL so I haven't gone in dept. Maybe someone else can provide more info on this.

44. how to get limited record in hql?    coderanch.com

HI every body i am using this query to get single value from data base but it is returning multiple values.I know setFirstResult and setMaxResult but except that can we use other things directly in hql. select count(S.humanID) from Human S,Animal W WHERE S.humanID=W.animalID group by S.humanID order by count(S.humanID) desc limit 0,1

45. Help with HQL    coderanch.com

46. HQL question    coderanch.com

47. why for HQL?    coderanch.com

48. HQL problem    coderanch.com

package roseindia.tutorial.hibernate; import org.hibernate.Session; import org.hibernate.*; import org.hibernate.cfg.*; import java.util.*; /** * @author Deepak Kumar * * http://www.roseindia.net * Select HQL Example */ public class SelectHQLExample { public static void main(String[] args) { Session session = null; try{ // This step will read hibernate.cfg.xml and prepare hibernate for use SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory(); session =sessionFactory.openSession(); //Using from Clause String SQL_QUERY ...

49. IFNULL() in HQL    coderanch.com

50. 24 Hour Format In HQL - 00:00:00 returned as 24:00:00 using HQL    coderanch.com

Hi All, This is my first post in this forum. I have some problem with HQL. We have oracle database which stores date in 24 hour format. While fetching the date value from the table using to_date, the value 00:00:00 is returned as 24:00:00 by Hibernate query. When this value is passed to a query it throws an exception Number must ...

51. Disadvantages of HQL.    coderanch.com

52. HQL help needed    coderanch.com

Hi All, I have two objects Person, Manager and the objects are mapped to database tables Person and Manager. I want to get all the persons having no manager at all or having manager whose name is "xyz". public class Person { Long id; String name; Manager manager; } public class Manager { Long id; String name; } SQL query to ...

53. HQL Language    zkoss.org

public void submit2(){ String advance = ((Textbox)getFellow("advance")).getValue().trim(); Listbox listbox = (Listbox)getFellow("items"); listbox.getItems().clear(); ApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext( (ServletContext)getDesktop().getWebApp().getNativeContext()); Adminop admin = (Adminop)ctx.getBean("adminop"); List items = admin.getSearchedItem2(advance); Iterator it = items.iterator(); while(it.hasNext()){ Item item = (Item)it.next(); Listitem li = new Listitem(); li.setValue(item); li.appendChild(new Listcell(item.getFilepath())); li.appendChild(new Listcell(item.getStrform())); li.appendChild(new Listcell(item.getDescription())); li.appendChild(new Listcell(item.getQcmeth())); li.appendChild(new Listcell(item.getBasisset())); li.appendChild(new Listcell(item.getInfo())); li.appendChild(new Listcell(item.getPg())); li.appendChild(new Listcell(item.getEs())); li.appendChild(new Listcell(item.getMulti())); li.appendChild(new Listcell(item.getCharge())); li.appendChild(new ...

54. Recognizing "true" / "false" in HQL    forum.hibernate.org

Hi - Here is my problem. In our software we have clients issuing HQL directly to the application server. We started out by using PostgreSQL as DB backend but now partners are requesting the possibility to use MS SQL. So my first task was to write new hibernate mappings compatible with SQL. So for instance boolean default "true": Code: ...

55. Comments in HQL?    forum.hibernate.org

Hello all, Does HQL support commenting? I've tried adding a comment to the end of my query in the C-style format and i'm getting errors. If HQL does not support comments is it possible to have Hibernate append a stack trace to all queries as some sort of Hibernate setting? I've been searching for the better part of a couple hours ...

56. How to escape underscore in HQL    forum.hibernate.org

57. How to project in HQL    forum.hibernate.org

58. HQL doubt    forum.hibernate.org

60. using timestampdiff in hql    forum.hibernate.org

Hi, I am new to Hibernate. I have a quick question regarding the usage of timestampdiff in HQL. I am using mySQL as the database and the following executes fine on MySQL. select timestampdiff(second,starttime, endtime) from requests where id = 234; I couldn't get the equivalent HQL query. Does HQL provide equivalent function? I tried searching for it, but in vain. ...

61. HQL and JoinTable    forum.hibernate.org

@Entity() @SequenceGenerator(name="QUESTION", sequenceName="QUESTION_SEQ", allocationSize=1) public class Question implements Serializable { ... @OneToMany @JoinTable( name="TOPIC_QUESTION", joinColumns={@JoinColumn(name="QUESTION_ID")}, inverseJoinColumns={@JoinColumn(name="TOPIC_ID")} ) private List topics = new ArrayList(); ...

63. HQL works    forum.hibernate.org

64. Easy way to create hql    forum.hibernate.org

65. HQL issue    forum.hibernate.org

66. Strange behaviour HQL    forum.hibernate.org

Hi, I have an entity object in persistence context, say a of type A with property a.prop = 'value1' and a.id = A a = new A(); a.setProp('value1'); em.persist(a); Then, em.find(A.class, ).getProp().equals('value1') as expected. Also changing prop works as expected: a.setProp('value2') and em.find(A.class, ).getProp().equals('value2') But I can't explain the following (after setting prop='value2'): List list = em.createQuery("from A a where ...

67. Novice in trouble with HQL    forum.hibernate.org

Hello, I've got a message like: org.hibernate.hql.ast.QuerySyntaxException: Datos is not mapped [from Datos] at org.hibernate.hql.ast.util.SessionFactoryHelper.requireClassPersister(SessionFactoryHelper.java:158) when I try to do a Run HQL query (from datos, I also try from Data), throught left-clicking on hibernate.cfg.xml. I don't know what I must do to get the results. I explain the situation: Netbeans 7.0 MySqld Database: agenda Table: datos Datos.hbm.xml

68. HQL and LoadEventListener    forum.hibernate.org

69. HQL    forum.hibernate.org

70. hql problems    forum.hibernate.org

I have a namedquerie : @NamedQuery(name=JuntaPreEnsamble.QUERY_ESTRUTURA_JUNTA_PREENSAMBLE, query=" from CorteBiselado as cb left join cb.estruturaPlano as ep where "+ " ep.fabrica= :fabrica " + " and ep.posicaoMargem= :posicaoMargem " + " and ep.modulo= :modulo " + " and ep.subModulo= :subModulo " + " and ep.tramo= :tramo " + " and ep.componente= :componente " + " and ep.elemento = :elemento " + " ...

71. Interpreting HQL    forum.hibernate.org

Hi, Is there a way in hibernate to interpret the HQL and find out which attribute are in the where clause? I have a requirement where a certain application user role should not be able to query on some class:attributes. For e.g A user with 'Non-Admin' role should not able to query 'Select * from User u where u.name=?'. Thanks in ...

72. HQL vs Critera - Am I missing something?    forum.hibernate.org

I have a simple model which is just a chain of one-to-many relationships: Country -< City -< Street The tables are mapped as entities and are returned as Map. The following test method is producing odd results: Code: public static void main(String[] args) { Session session = HibernateSessionFactory.getSession(); List> ...

73. HQL outside Hibernate    forum.hibernate.org

74. HQL    forum.hibernate.org

I am trying to map the following query: select c.col3 from table1 a, table2 c where (a.col1_id = c.col2) and c.col3 in (select col3 from table2 where col2=51) Below are my table defenitions Table 1 col1 - PK Table 2 col2- FK col3 The above query works with Oracle. Can somebody suggest how to map it with HQL thanks BD

75. a question about HQL    forum.hibernate.org

Hello, imagine that I have the following object public class Process { ... Set ActivityList; ... } public class Activity { ... Process process; String name; ... } I want to use HQL to retrieve all Processes where activities with name equals "BLABLA" with a WHERE clause expression like ... WHERE process.activityList.name="BLABLA" Is the WHERE clause syntax correct ?? Meaning is ...

76. Same tuple repeats 8 times: help with HQL    forum.hibernate.org

I am building an application using a legacy database. For one of the application modules, I need to extract the usecase ids and usecase names for a given user with a userid and an actor id. The classes "User", "Actor" and "Usecase" have many-to-many associations among themselves. I have placed the HBM.XML files for the three at the end of this ...

77. a little hql help...    forum.hibernate.org

ok, this hibernate stuff is new to me... i need help translating a simple sql query like so: mysql> select * from mdcontent m, mdmediachild ac where m.md_id=ac.md_id and ac.media_id=; to use the mappings i've setup in hibernate (what i have so far) sQuery.append("select"); sQuery.append(" content"); sQuery.append(" from"); sQuery.append(" com.adobe.studio.metadata.ContentItem as content"); sQuery.append(" where"); sQuery.append(" content.publishdate <= ...

78. Trouble accessing references - HQL question    forum.hibernate.org

Regular Joined: Fri Sep 12, 2003 12:40 pm Posts: 65 I'm trying to retrieve the children of a set of children based on the following SQL and mapping files. The results follow. Example: Code: Query query = session.createQuery("SELECT pr from ProductReview as pr where pr.id = ? "); query.setString(0, "402882c5f7d7367100f7d736b3900001"); ...

79. How to write HQL for the following question    forum.hibernate.org

I have a class Department which is mapped to table department. class Department { private long id; private String name; private Department parentDept; private Set subDepts; } Department may has zero or one parent department and zero or more sub-departments which are also of Department type. I wanna get the following information, but don't know how to write such kind of ...

80. Help with HQL    forum.hibernate.org

I have an application structured almost the same as the example of customer>order>lineItem>product but when i am trying to query for the transactions that have a certain product involved, like in SQL: select transactionInfo.* from transactionInfo join transactionItemInfo join productInfo where productInfo.productId = 4 i am having all kinds of difficulties in HQL. finally, i tried just having: "select transactionInfo from ...

81. Help with HQL    forum.hibernate.org

82. Simple (or not so simple) hql Problem    forum.hibernate.org

Hi, I have read all the Manuels and tried to find a Solution in the Forum but I wasn't able to. So I hope this is the right place to ask the following question. I'm developing a kind of an issue tracking system with hibernate. I have Issues (so called Ivents) which have Details. Every single Detail Entity has a bunch ...

83. HQL & Set Question    forum.hibernate.org

I have a class called A and it contains a set of class B. Class B in turn has a set of class C, and it in turn has a set of class D. The relationship between these class is one-to-many ( ) Now my question is can a perform a query like this using HQL. select A.B.C.D from A.B.C where ...

84. hql question    forum.hibernate.org

Hi all, I'm finally getting to some interesting HQL, having some problems: Code: User <----------> * Post table user(id integer) table post(id integer, parent integer) class User { int id; Set posts; // inverse many-to-one .... } class Post { ... } I'm trying to get a count of ...

85. HQL question (I apologize in advance)    forum.hibernate.org

I've been looking over the HQL chapter and still can't figure this out. I have an object, a User, who has a set of roles, called persistentRoles. I need to make a Hibernate query that returns all users who have no roles. The best I've come up with is this: from users in class md.user.User where users.persistentRoles.elements is null This works ...

86. HQL help    forum.hibernate.org

What is the best way to map results of a joined query. For example I have a query ======================== select p.packslip, c.cust_name from pickhead p, custmstr c where p.cust_num = c.cust_num order by c.cust_name ====================== and I want to load the result into a class with two members. How would I approach this? Can some one please provide a link to ...

87. HQL challenge    forum.hibernate.org

88. HQL beginners question    forum.hibernate.org

hello! sorry for this stupid dump question but iot seems like someone stand on the line here -:) i have a table users and a class user for it, mapping is all fine and working. now i want to find a user with the given password and username in my table. in sql it is something like that : select * ...

89. HQL question    forum.hibernate.org

Hi, I'm trying to figure out how to do the HQL for select distinct. I have an object called BOL that maps to table called Mbol table structure ================= rowid BOLNum OrderNum SKU ShipQuantity Object =========================== public class BOL { private long rowID; private String bolNumber; private String orderNum; private String sku; private int shipQuan; public String getOrderNum() { return orderNum; ...

90. hql question    forum.hibernate.org

Hi, I have a class named "Configuration" which has "nodes" collection, which is a component collection.The component (SdhNode) that comprises the elements of nodes collection has many to one association to class "Salon". I would like to run a query that returns the Configuration instances that has both salon1 and salon2 (which are instances of Salon class) in their nodes. How ...

91. HQL internal algorythms    forum.hibernate.org

Its best to reference the source. It is difficult to explain it here (and some of the deep internals I am not that familar with). In anycase, since HQL is based on SQL with the ORM twist alot of the HQL is passed directly without modification to the SQL engine. Where most of the work needs to be done is in ...

92. HQL implementation ?    forum.hibernate.org

93. HQL    forum.hibernate.org

94. Hibernate HQL how to?    forum.hibernate.org

Hello guys can someone tell me how to do the following Lets us suppose I have a table foo with an M-M relation to table bar. foo ID | Name bar ID | Name foo_bar foo_ID | bar_ID What would be an HQL query to check if a foo has a bar with ID = x AND a bar with ID ...

95. HQL problem    forum.hibernate.org

Hello everybody, I am a new user of hibernate. It works fine. But now i m in problem. I have a class: SurveyDTO and another class SurveyLineDTO SurveyDTO contains the collection of SurveyLineDTO. The attribures of SurveyDTO are surveyReportImportDate reportDescription ........................... and the attribues of SurveyLineDTO are surveyDate dirCode doctorName teritoryCode productType ................ Here is my hbm.xml file:

96. pls help me HQL problem    forum.hibernate.org

Hello all, Here is my sql. A user can have many roles. If want to execute the HQL select a.name,b.roleName,b.description from UserDTO a ...

97. Hibernate HQL Issue    forum.hibernate.org

Hi guys, I am using Weblogic portal and Hibernate 2.1 I am writing a Java control in Weblogic portal (in the web directory) that makes a call to Hiberate to retrieve an object from the database. Here is the code : result = sess.find("from com.accidentfund.common.db.hibernate.PolicyDim as policy where policy.policyNumber = ?", vo.getPolicyNum(), Hibernate.STRING); I get back : net.sf.hibernate.JDBCException: Could not execute ...

98. HQL problem    forum.hibernate.org

99. HQL question    forum.hibernate.org

Greetings, HQL wizards. I'm looking for a single HQL query to solve this problem. I have a table called Charge. It has cols for amount, borrower, and lender. A user can be both a borrower and lender. I want to find the balance between user1 and user2, from the perspective of user 1. For example, for the table: Code: borrower ...

100. how can create this HQL    forum.hibernate.org