Subquery 1 « Query « JPA Q&A





1. understanding JasperReports and JRBeanCollectionDataSource    stackoverflow.com

I now have my jasper reports working from my JRBeancollectionDataSource in my code! I am just a bit confused about some things... When I am designing reports in iReport, I create ...

2. Hibernate subquery    stackoverflow.com

I have a problem in creating subqueries with Hibernate. Unfortunately the Subqueries class is almost entirely undocumented, so I have absolutely no clue how to convert the following SQL into a ...

3. Toplink IN subquery    stackoverflow.com

I hava 2 objects associate by oneToMany relationship("One Model can have many events"). I'm trying to make a subquery in ejbql to find models for one event, like this:

SELECT model 
FROM RegModelValue ...

4. Subquery using derived table in Hibernate HQL    stackoverflow.com

I have a Hibernate HQL question. I'd like to write a subquery as a derived table (for performance reasons). Is it possible to do that in HQL? Example: FROM Customer WHERE country.id in (SELECT id ...

5. How do I do a JPQL SubQuery?    stackoverflow.com

It is possible to do the equivalent of this sql query in JPQL?

SELECT * 
FROM   COUNTRIES c WHERE COUNTRY_ID IN (
SELECT DISTINCT COUNTRY_ID 
FROM PORTS p 
WHERE p.COUNTRY_ID = ...

6. how to write subquery in hibernate    stackoverflow.com

i have SQL query , i dont know how to write in hibernate

select lp.lnprdtname,la.lid,la.step 
from mfic.lnapp as la 
left join mfic.lnprdt as lp on lp.lnprdtid in 
    (select ...

7. Hibernate Criteria Subquery    stackoverflow.com

I need to do this SQL query with detachedCriteria:

SELECT g.id FROM games g
WHERE NOT EXISTS (
    SELECT 1 FROM users_games ug WHERE ug.user_id = 1 AND g.id = ...

8. NPE in HQL subquery    stackoverflow.com

I have an error in the following HQL Query:

         em.createQuery(
            "SELECT new ...

9. regarding subqueries in hql    stackoverflow.com

Is it possible to select the entire data from the subquery without where condition in HQL? If Possible can you pls send that hql query......





10. Subquery in select clause    stackoverflow.com

i'm trying, as in title, to insert a subquery in select clause like in this simple sql:

SELECT id, name, (select count(*) from item) from item
this is obviously only a mock query ...

11. Hibernate Criteria and Count Column    stackoverflow.com

I am trying to return an entity with a column that has the count of another table that is a one to many relation. I want to do this using hibernate ...

12. NHibernate fluent (QueryOver) replacement for HQL with correlated subquery    stackoverflow.com

Background, using FluentNHibernate, lastest dev build working with NHibernate 3.0. Here is the type declarations for WorkIncident:

// Enumeration used in class below.
public enum TicketStatus
{
    Open = 1,
   ...

13. Hibernate: how to make EXISTS query? (not subquery)    stackoverflow.com

For example:

EXISTS ( SELECT * FROM [table] WHERE ... )
How to make such query using Hibernate?

14. Limit in subquery with JPQL    stackoverflow.com

I'd like to get the average price of my top 100 products via JPA2. The query should look something like this (my sql is a little rusty):

select avg(price) from (
  ...

15. Hibernate many-to-many subquery    stackoverflow.com

I have three tables; User, UserRoles and UserRoleRelationships (many-to-many join table). I need to run a SQL query like:

select * from UserRoles where roleId not in (select roleId from UserRoleRelationships where ...

16. JPQL / QueryDSL: join subquery and get aliased column    stackoverflow.com

I'm trying to get an average for a count on a groupBy by joining with a subquery. Don't know if that the right way to go at all but I couldn't ...





17. can i join a subquery with other tables in JPQL?    stackoverflow.com

i am trying to achieve something like in JPQL:

select d from Detail d 
inner join (select m from Master m) as m
on m.document_no = t.document_no
can this be achieved? i am just ...

18. JPA/hibernate subquery in from clause    stackoverflow.com

We're using JPA with hibernate as the provider, we have a query that contains a join with a subquery in the FROM clause, but we get the following error:

org.hibernate.hql.ast.QuerySyntaxException: unexpected ...

19. Translate HQL subqueries to Criteria    stackoverflow.com

I would like to translate this structure of HQL:

FROM Entity_1 obj
WHERE obj IN (FROM Entity2) OR 
      obj IN (FROM Entity3)
How can it be done?

20. HQL Subquery Query Select Problem    stackoverflow.com

I always geht the error "too many Columns" when i execute this query. SELECT o FROM Overlay o WHERE ( :coordinate ) IN ELEMENTS(o.blocksCoordinates) If i do it in sql it works:

 ...

21. NHibernate HQL subquery problem    stackoverflow.com

My (simplified) domain model contains a many-to-many relationship called Ownership between Customer and Product. I would like to write an NHibernate HQL query that tallies the number of customers who own ...

22. Correlated subqueries in NHibernate    stackoverflow.com

I am just starting with NHibernate and I am struggling with trying to convert some SQL with subqueries into either HQL, Criteria or QueryOver syntax. Any advice or tips would be ...

23. Joining table and subquery in jpa    stackoverflow.com

I have two tables T1 and T2 where t2 is result of subquery to make it clear

select * from T1 join (select * from T3 where foo is not null) T2 on ...

24. SubQuery in Hibernate    coderanch.com

Hi!!! There's problem in Hibernate. I have three tables as : Department(Dno,Dname) Employee(Eno,Dno,Salary) Project(Pno,Dno) i.e Here Dno represents The Department that controls that project. Now I Want Output as : Dname,sum(Salary),count(Project) i.e. Total Salary paid to each Department and total number of projects controlled by each department. i.e. Group by dno in Employee for Sum(Salary) and Group by dno in Project ...

25. Correlated Subquery in Hibernate    coderanch.com

I'm working on converting a fairly hairy SQL query into HQL and running into some trouble. I was hoping someone else would be able to shed some light on the problem. Here's the original SQL query: SELECT pl.prevID, pl.prevDescription, (SELECT count(prevID) FROM MCase m, CRev c WHERE m.caseNumber = c.caseNumber AND disDate BETWEEN '1/1/2007' AND '3/31/2007' AND m.isFinalized = 'Y' AND ...

26. Subquery in Hibernate 2.0    coderanch.com

Hi, I am using following subquery in Hibernate:It comes up with the error: missing right paranthesis Table: ----- Area ---- modifiedTS timestamp id number pkgId number serialNumber varchar2 select serialNo.id from Area area where area.pkgId=3 and area.modifiedTS in(select max(a.modifiedTS) from Area a where a.pkgId=3 group by a.serialNumber) Underlying database is Oracel 9.0. The above query executes in oracle but i couldnt ...

27. subquery sql to hql    coderanch.com

Hey I have the same problem Did you get this resolved This is a sample query "select r1.roleId from (select r1.roleId from Roles r1)r1" (I have much complex query than this) I get this as error when I run the above Caused by: org.hibernate.hql.ast.QuerySyntaxException: unexpected token: ( near line 1, column 22 [select r1.roleId from (select r1.roleId from com.jci.bots.data.Roles r1)r1] at ...

28. Hibernate Criteria for Subquery    coderanch.com

29. hibernate subqueries    coderanch.com

Thanks .. I am using displaytag for pagging(pagination )and sum of particular column. when i give page size it is not showing the total. if I remove the page size it is showing the total of particular column. hear is my code ...

30. Hibernate subquery    coderanch.com

31. from subquery in Hibernate    forum.hibernate.org

Hi all, I have a query with subselect and I found that Hibernate hasn't support for it. Do you know how to correct (maybe after optimization:P) this query in HQL? SELECT t1.greens, t2.oranges, t3.reds FROM (SELECT count(t) as greens FROM tableX t WHERE t.validation="GREEN") t1, (SELECT count(t) as oranges FROM tableX t WHERE t.validation="ORANGE") t2, (SELECT count(t) as reds FROM tableX ...

32. Subquery problem    forum.hibernate.org

Hello Here are tables I have in database: User => TeamParticipate <= Team => Participate <= SubProject <= Project I need to get list of users who are in teams that participate in subproject which is in certain project. But when I'm trying to do this: Code: public List getUsers(int p_id) { ...

33. Hibernate Criteria for Subquery    forum.hibernate.org

34. Subquery in Criteria    forum.hibernate.org

35. Updating with subquery    forum.hibernate.org

36. Subquery in From clause    forum.hibernate.org

37. [newbie] Subquery order by    forum.hibernate.org

38. HQL and correlated subqueries    forum.hibernate.org

SELECT t_user.user_id , t_request.req_id , t_cycle.cycle_id , t_cycle.time FROM t_user INNER JOIN t_request ON t_request.user_id = t_user.user_id INNER JOIN t_cycle ...

39. Howto execute a subquery which contains OFFSET and LIMIT?    forum.hibernate.org

Hi Martin, The Problem with using setFirstResult()/setMaxResult() on the Query directly is performance, because at least in my case PostgreSQL does JOIN all rows, not only the rows between OFFSET and LIMIT even if it would be possible to do so, because the columns joined in don't affect the ordering. Is there some way to escape SQL keywords not known to ...

40. joining 2 subqueries    forum.hibernate.org

select t2.* from ( select * from SYSTEM.TBL_TRANSACTIONS) t2 JOIN ( select MERCHANTID, CARDID, Count(CARDID) as nbTxns from SYSTEM.TBL_TRANSACTIONS GROUP BY MERCHANTID, CARDID) t1 on t2.CARDID = t1.CARDID AND t2.MERCHANTID=t1.MERCHANTID WHERE (nbTxns > 5);

41. Hibernate subquery    forum.hibernate.org

42. Hibernate Update with subquery    forum.hibernate.org

43. Problem with Hibernate HQL query and SubQuery    forum.hibernate.org

Newbie Joined: Fri Apr 08, 2011 7:07 pm Posts: 2 Hi everyone! I have a problem with a Hibernate query with sub-query for a report. I have a Native SQL Query (SQLServer) with nested sub query and I need convert to Hibernate HQL. The Native SQL query is: Code: SELECT ma.persona, ma.totalA, ...

44. Join on Subquery (Criteria)    forum.hibernate.org

Hi, I'm trying to create a Criteria query which the SQL equivalent would be : Code: SELECT f2.* from fonctionnalite f2 join ( SELECT distinct f.id from fonctionnalite f join lien_processus_applicatif_Fonctionnalite l on l.id_fonctionnalite = f.id ...

45. SUBQUERY in SELECT    forum.hibernate.org

Hi, I'm trying to write a complex query in hql. According to the documentation a subquery is possible in select in hql: Exemple given in doc: select cat.id, (select max(kit.weight) from cat.kitten kit) from Cat as cat My query : select pi.mId, (select max(si.mId) from pi.mSI si) from PI as pi My object PI has a collection of object SI. When ...

46. Subqueries in from clause    forum.hibernate.org

47. How to write named native subqueries?    forum.hibernate.org

Hi, I have given a task to write a named native subquery like Code: select c.comp_name from company c where c.cid = (select cid from com_usr_rel where uid=1100) The entities are company Code: @Entity public class Company implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy=GenerationType.AUTO) ...

48. Subquery on Hibernate    forum.hibernate.org

I have some like this Code: select object1, object2.data, object3.data from Object object1 left join fetch object1.object2 as object2 left join fetch object1.object3 as object3 ...

49. Translate HQL subqueries to Criteria    forum.hibernate.org

50. How to use Hibernate criteria to write subqueries?    forum.hibernate.org

Hi Guys, I am newbie for using hibernate criteria queries We have a applpication running and i have to make changes to existing criteria query I know sql that will fetch me the reqd resultSet. But i dont know how to translate it to criteria Below is my sql query Code: select h.employeeCode, h.yymm,sum(h.amount) as amt,COALESCE(d.lessamnt,0) from hist_sal h left join ...

51. Object with Collection (set) Subquery?    forum.hibernate.org

Hi, I have an object with various attributes, and it in turn has several set collections mapped. I am trying to query a set of objects out based on both the object parameters and specific members of some collections. To show an example, I have a User and a Preference object defined as such (with extra data stripped for clarity): Code: ...

52. get total count from a subquery    forum.hibernate.org

Hi, I want to get the total number of records of a query. My query is like this: "from P p where p.userID in (:userIDs) "; the userIDs is a list of keys. ==================== i tried to do the following to get the total number of record, but it doesn't work for my case. String request = "select count(*) from P ...

53. HQL. Help SubQuery in many-to-many    forum.hibernate.org

I have to classes: user with usrId as a key. Table users userGroup with usgId as a key. Table user_groups I have a many-to-many relationship between them using other table user_group_details with both keys. I want to make a query to select the userGroups with the id of the user. I have this: select elements(user.userGroups) from com.miradores.vmon.data.UserGroup as usergroup ,com.miradores.vmon.data.User as ...

54. Problems with subqueries.    forum.hibernate.org

I'm using Hibernate 2.1.1. My mapping files where generated with Middlegen R3. Can't get my query to work. Keeps giving me: Code: net.sf.hibernate.QueryException: path expression ends in a composite value: versaodocu0_.id [from vo.VersaoDocumento vd1 where vd1.comp_id.documento.id = ? and vd1.id = (select max(vd2.id) from vo.VersaoDocumento vd2 where vd2.comp_id.documento.id = ?)] at net.sf.hibernate.hql.PathExpressionParser.getWhereColumn(PathExpressionParser.java:370) at net.sf.hibernate.hql.WhereParser.doPathExpression(WhereParser.java:352) ...

56. Native SQL in subqueries    forum.hibernate.org

Hi, I have a class, let's say Customer, that is mapped on a certain table. I'd like to know how to write a HQL query that uses as condition a subquery on a table not mapped on a class. Here is an example: from Customer as customer where customer.name in (select my_column from my_unmapped_table) When I try this query, Hibernate tries ...

57. using criteria in subqueries    forum.hibernate.org

Hello, I would like to use hibernate as an persistence layer of my Forum. I use the Criterions and Criterias to build queries, but i don't know, how can I make a subquery with these components. I would like change the following section with using criterions Code: try { Session sess = HibernateSession.currentSession(); ...

58. Shared collections and subqueries on member sets    forum.hibernate.org

Hello, I'm using hibernate for a simple app where I have the following structure (simplified): Code: class A { Set overrides; // (set of class B) } class B { Date startTime; Date endTime; } I have used the session to load an instance of class A (myA), then ...

59. native sql query - subquery does not work    forum.hibernate.org

hello, I am using oracle 8i with Jdk1.4 and OracleDialect. I need to execute a sql query where the schema says that an employeeLeave has multiple statuses. I am trying to run the following java code. Transaction tx = sess.beginTransaction(); String[] strParams = new String[]{"a","b","c"}; Class[] clsParams = new Class[]{LoaEmployeeLeave.class,LoaEmplLeaveStatu.class, LoaEmplLeaveStatu.class }; Query q = sess.createSQLQuery("select {a.*} from loa_employee_leave {a}, " ...

60. Subquery in select clause    forum.hibernate.org

61. SubQuery/HQL help    forum.hibernate.org

Hibernate version 2.1.6 String sql="from F41021 as f41021 " + "where ...

62. How can I write this subquery?    forum.hibernate.org

63. Limit in subquery    forum.hibernate.org

Hi, I would like to use LIMIT 1 in subquery, but Hibernate creates from my query: select o from Cobject o join fetch o.objectDatas od join o.keyalias ka where od.enabled = :objectDataEnabled and od = (select od2 from ObjectData od2 join od2.cobject o2 where (o2 = o) limit 1) ORDER BY o.orderCount DESC this one (only relevant part): ...objectdata1_."ID"=(select objectdata4_."ID" from ...

64. Translate subquery    forum.hibernate.org

65. Whereis the subquery?    forum.hibernate.org

Newbie Joined: Thu Dec 09, 2004 5:18 am Posts: 1 Why do I get this, where is the subquery??? I use SQL server 2000, HIBERNATE 2,1,7 userId is of type String and type is Integer HibernateTemplate template = ServiceLocator.instance().newHibernateTemplate(); List l = template.find( "from Report report where report.userId = ? and report.reportType = ? and report.signed = false", new Object[]{userId, type}); ...

66. Can subqueries be disabled?    forum.hibernate.org

67. Subquery Problem    forum.hibernate.org

68. Attempting to use new Subquery support for Criteria    forum.hibernate.org

Hibernate version: Hibernate 3 beta 4 I'm trying to use the following Detached Criteria to use as a subQuery and am encountering some weirdness I can't quite figure out. Based on executing this by itself: Code: DetachedCriteria subQueryCriteria = DetachedCriteria.forClass(AgmtContractLine.class); subQueryCriteria.createAlias(AgmtContractLine.VERSIONS_PROPERTY, AgmtContractLine.VERSIONS_PROPERTY); subQueryCriteria.add(Restrictions.eq(AgmtContractLine.VERSIONS_PROPERTY + "." ...

69. HQL query seems to only show subquery    forum.hibernate.org

Read the rules before posting! http://www.hibernate.org/ForumMailingli ... AskForHelp Hibernate version: 2.1.6 Mapping documents: Code: ...

70. subquery problem in hql, advice please    forum.hibernate.org

Hi guys, I'm trying to do subselects and I'm a little confused/lost. The object has 2 sets, one is a set of contacts the other is a set of contact lists. A contact list is itself a set of contacts. What I want to do is provide a funciton that returns a set of contacts that is the union of those ...

71. Hibernate and subqueries    forum.hibernate.org

Hi all who know how can i resolve my issue with that querie ? I am using Hibernate 2.1.6 with Oracle 9i net.sf.hibernate.QueryException: in expected: SELECT [ SELECT SUM(taille) FROM ( SELECT DISTINCT fichierId, taille FROM com.test.InstanceParTransfert AS Ipa, FROM com.test.Fichier AS Fic, FROM com.test.Transfert AS Tr WHERE Ipa.comp_id.fichierIdFk = Fic.fichierId AND Tr.transfertId = Ipa.comp_id.transfertIdFk AND Ipa.comp_id.transfertIdFk = :transfertId AND Tr.dateCommande ...

73. [PLEASE HELP] : Hibernate and subqueries    forum.hibernate.org

Hi, i am trying to perform that query and i have exception : Query q = session.getSession().createQuery("" + "SELECT M2.machineId " + "FROM ( " + " SELECT * " + " FROM fr.test.Machine Ma " + ") M2 " ); Hibernate (2.1.6) throws me that exception : net.sf.hibernate.QueryException: in expected: SELECT [SELECT M2.machineId FROM ( SELECT * FROM fr.test.Machine Ma ...

74. Is Criteria.createAlias() supported in SubQuery?    forum.hibernate.org

Hibernate version: 3.0.2 Code between sessionFactory.openSession() and session.close(): Built up the following criteria: DetachedCriteria detachedCriteria = DetachedCriteria.forClass(Location.class); DetachedCriteria subQueryCriteria = DetachedCriteria.forClass(AgmtContractLine.class); subQueryCriteria.createAlias("versions", "versions"); subQueryCriteria.add(Restrictions.eq("versions.endUse", "Sales")); subQueryCriteria = subQueryCriteria.setProjection(Property.forName("versions.sourceLocation")); detachedCriteria.add(Subqueries.propertyIn("addrId", subQueryCriteria)); detachedCriteria.getExecutableCriteria(session).list(); Full stack trace of any exception that occurs: org.hibernate.exception.SQLGrammarException: could not execute query at org.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConverter.java:70) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43) at org.hibernate.loader.Loader.doList(Loader.java:1560) at org.hibernate.loader.Loader.list(Loader.java:1540) at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:113) at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1254) at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:299) ...

75. Subqueries.exists Criteria    forum.hibernate.org

Hibernate version: Hibernate 3.0.3 Db: MySql 4.1.7 When trying to use Criteria.add(Subqueries.exists(DetachedCriteria)), I have the following problem: Working with the DetachedCriteria only by itself works, but when adding this to Criteria.add(Subqueries.exists(...)), it generates invalid sql. ------------------------------------------------------------------------- Working example Example with using only the DetachedCriteria: /** article version has collection of chapters, chapter has collection of textBlocks **/ DetachedCriteria dt= DetachedCriteria.forClass(ArticleVersion.class) .setProjection(Property.forName("id")) ...

76. SubQuery in Select Clause    forum.hibernate.org

Newbie Joined: Mon May 24, 2004 8:34 am Posts: 5 Need help with Hibernate? Read this first: http://www.hibernate.org/ForumMailingli ... AskForHelp Hibernate version: 3.0.5 Name and version of the database you are using: DB2 v8.2 The generated SQL (show_sql=true): Hibernate: select year(contentite0_.PUBLISHDATE) as col_0_0_, month(contentite0_.PUBLISHDATE) as col_1_0_, count(contentite0_.PUBLISHDATE) as col_2_0_ from KC.CONTENTITEM contentite0_ group by year(contentite0_.PUBLISHDATE) , month(contentite0_.PUBLISHDATE) I am a little ...

77. subquery with limit does not work anymore in hibernate 3    forum.hibernate.org

StringBuffer sql = new StringBuffer("select count(*) from TrainingsLog as log where log.richtig = true and log.id in ( select log2.id from TrainingsLog as log2 where log2.user = :userId and log2.loId = :loId and log2.loTyp = :loTyp order by log2.datumAnlage desc limit :limit ) "); Session session = HibernateUtil.getSession(); Query query = session.createQuery(sql.toString()) .setLong("userId", user.getId().longValue()) ...

78. Problems with Hibernate and subqueries    forum.hibernate.org

What is wrong with this query? FROM table_a as a WHERE a.id in ( from table_b as b where b.opt_value='dsd') Hibernate version: 2.1.7c Mapping documents: Code: ...

79. subquery in subcriteria does not work    forum.hibernate.org

(Hibernate version: 3.0.5) I have some problems using a subquery, first it cannot be used with a property of an associated entity: Criteria criteria = session.createCriteria(A.class); criteria.add(...); DetachedCriteria subQuery = DetachedCriteria.forClass(B.class); subQuery.setProjection(Property.forName("B-some").max()); criteria.createCriteria("A-to-B-FK") .add(Property.forName("B-some").eq(subQuery)); This code runs into a ClassCastException: in SubqueryExpression.toSqlString(), line 43: final SessionImpl session = ( (CriteriaImpl) criteria ).getSession(); criteria is cast to CriteriaImpl, but is of type ...

81. Cannot use subqueries in from clause. Is there an alternativ    forum.hibernate.org

With hibernate I cannot use subqueries in from clause. I got an exception telling me that the token "(" is not expected. I read in this forum that hibernate is not implementing subqueries in from clause. So my question ist: what is the alternative? I have the following concrete problem: - I have 1 table with column "from" and "to" and ...

82. SELECT in SELECT subquery    forum.hibernate.org

Hi all, I decided to post my problem here in forum, because I spent a lot of time by looking for any solution, trying everything, but without any positive results. I have this query: select co.name, u.surname, u.firstname, c.car_id, c.fin_str, m.name, mo.name, c.insert_date, c.offer_expiration, (select count(*) from Offer o where o.car_id = c.car_id) as offers_count from Car c, Users u, Company ...

83. HQL and subqueries    forum.hibernate.org

Hi all, AAAAAARRGGHHH! I've been trying to get this query with a subquery to work but it seems I'm doing something wrong. All of the required info is below but in summary: Players have one or more PlayerStatus's. PlayerStatus's have a year. I want all players, but only the team that's shown in the latest year for each player. The SQL ...

84. Are Criteria Subqueries and Joins now working in 3.1??    forum.hibernate.org

I can confirm that this doesn't work now in 3.1. Can anyone suggest a work around for using subqueries with joins in QBC? Seems like a pretty funamental feature for the Criteria API to have particularly when faced with a sophisticated query builder. I've been a proponent of non-HQL based builders for sometime, but may have to rethink this without a ...

85. How to write a subquery in "order by"    forum.hibernate.org

86. SQL subquery, can't get the tuples    forum.hibernate.org

I have an SQL query which includes a subquery in the FROM clause. The query works in POSTGRES SQL editor and returns one row with 3 columns as expected. The same query, in Hibernate context returns a row as well but I can not access the fields. (See my server log & exception) Would you give me a direction on how ...

87. HQL with subquery - QuerySyntaxException: unexpected token    forum.hibernate.org

Hello, I am using Hibernate 3.1. I have an Oracle 9i table MY_DOWNLOAD (id, filename) which is mapped by a hibernate xml-file to an Java-Bean ThisDownload. The class ThisDownload has getters and setters for id and filename and is working fine when I query for instance from ThisDownload. But now I have the following query with an included subquery: from ThisDownload ...

88. inability to use joins in a subquery    forum.hibernate.org

89. Quotes in subquery    forum.hibernate.org

Hello. I have the following problem. When I execute a criteria, hibernate try to execute this sql sentence: select organizati0_.`pk` as pk1_164_0_, organizati0_.`name` as name2_164_0_, organizati0_.`Organization_type` as Organiza3_164_0_, organizati0_.`Organization_parent` as Organiza4_164_0_, organizati0_.clazz_ as clazz_0_ from ( select Organization_parent, name, pk, Organization_type, 0 as clazz_ from `Organization` union select Organization_parent, name, pk, Organization_type, 1 as clazz_ from `SalesOrg` ) organizati0_ where organizati0_.`pk`=? ...

90. Quotes in subquery    forum.hibernate.org

Hello. I have the following problem. When I execute a criteria, hibernate try to execute this sql sentence: select organizati0_.`pk` as pk1_164_0_, organizati0_.`name` as name2_164_0_, organizati0_.`Organization_type` as Organiza3_164_0_, organizati0_.`Organization_parent` as Organiza4_164_0_, organizati0_.clazz_ as clazz_0_ from ( select Organization_parent, name, pk, Organization_type, 0 as clazz_ from `Organization` union select Organization_parent, name, pk, Organization_type, 1 as clazz_ from `SalesOrg` ) organizati0_ where organizati0_.`pk`=? ...

91. Does it use subquery?    forum.hibernate.org

I have 2 object: Teacher and Student, they are many-to-many relationship. In Tearcher class it has a list of Students. I try to make a hql query to get all the teachers which have a student's name as "Peter". Currently I have 2 queries have seems to work properly: 1. select distinct t from Teacher t, Student s where s.name="Peter" and ...

92. subqueries    forum.hibernate.org

93. Subquery in from clause    forum.hibernate.org

I'm trying to figure out how to work around Hibernate's limitation of no subqueries allowed in the from clause. Here's the set up: A store sells individual baseball cards to customers. Code: Table: Customer cust_id 32 52 71 Table: CustomerGroup group_id 12 11 Table: GroupRef group_id ...

94. DetachedQuery, Subqueries.exists: HibernateSystemException    forum.hibernate.org

Could you propouse some solution for this situation: I have an Entity which has OneToMany relation to Attribute. I want to select all entities that have Attribute.name = 'attr1' and Attribute.value='val1' and Attribute.name = 'attr2' and Attribute.value='val2' And there are many attributes may be added... I decided to perform such filtering with sub selects, but got this exception: org.hibernate.MappingException: Unknown entity: ...

95. subquery problem    forum.hibernate.org

96. subquery - criteria - problem    forum.hibernate.org

97. subquery and ordering    forum.hibernate.org

Hibernate version:3.2 Mapping documents: ----------------------------------------------------------- ----------------------------------------------------------

98. HQL Subquery within a Criteria query?    forum.hibernate.org

99. HQL doesnt work when using subqueries    forum.hibernate.org

This HQL works when I run it... select A.pdcid as PDC_ID, A.afterDate as ISSUE_DATE, count(A.pdcid) as NumRecord from WrkTable A where (A.oneInd = 'B' or A.oneInd is null) and A.packageId in (select B.packageId from SrcTable B where B.comp_id.fileId = 'file123') group by A.pdcid, A.afterDate order by count(*) but when I try to restrict the number of records the query above returns ...

100. hql subquery problem    forum.hibernate.org

Hello! I have the following problem: When I try to create an HQL query with Hibernate that contains subqeries in the select list that are part of complex expressions, I get an exception. Looks like I cannot have HQL calculate the quotient of two values that are the results of two subqueries. Marci Hibernate version: 3.1.3, 3.2 Code between sessionFactory.openSession() and ...