1. How can I find out the length of a column in a JPA @Entity? stackoverflow.comI've got a String column defined with
The attribute contains log information and can be longer than the defined length. In this case, the field can be safely truncated ... |
2. Hibernate query for entity based on whether related entity property is null? stackoverflow.comI have the following mapping:
|
3. Query partial entities with JPA stackoverflow.comI have a JPA entity similar to;
In about 2 out of 5 queries ... |
4. Hibernate Entity sort column configuration stackoverflow.comIs there a Hibernate configuration (hopefully an annotation on a classes mapped @Column field) that would let me sort a collection of entities associated with the loaded entity by a given ... |
5. NHibernate HQL Group by Entity stackoverflow.comIs it possible to run a query similar to this one in HQL without having to specify all of the column names.
|
6. Querying entities which have a specific collection entry using HQL stackoverflow.comI have |
7. Apply native SQL where clause to Nhibernate query for entity stackoverflow.comI have this problem. I have a module (module 1) that use Nhibernate to manage entity persistence; this module interacs with an other module (module 2). The "module 2" allows to generate dynamically ... |
8. how do I group by a property of a related entity in a criteria? stackoverflow.comI'm writing a criteria that should group the results by a property of a related entity. I've tried using an alias, tried using the property path itself, but so far I ... |
9. Second level cache for entities with where clause stackoverflow.comI am wondering where the hibernate second level cache works as expected if I put a where clause in the hbm.xml class definition:
|
10. Select non-entities with JPA? stackoverflow.comIs it possible with JPA to retrieve a instances of a non-entity classes with native queries?
|
11. Select all entities of exact class, but not derived from it using NHibernate Criteria API stackoverflow.comI have two classes: |
12. Refresh of an Entity with a colllection throws a UnresolvableObjectException when an Element of the collection got deleted stackoverflow.comWe have a two tier Swing application using Hibernate. Sometimes we manipulate an object in one session (A), which we know in another session (B) as well (two different Java Instances, ... |
13. HQL - find entity where property x is highest stackoverflow.comCan HQL queries do this? "get the UserEntity where the property creationTimestamp is the most recent of all UserEntities". Essentially a query to return the "newest user" in our program where each UserEntity ... |
14. Hibernate: Refreshing an object with specified entity-name stackoverflow.comIn my application, I have a model with mixed static (POJO) and dynamic (Map) entities. As I wanted to have unqualified entity names all over the place, I gave the mappings ... |
15. Refreshing entity instance after using merge in hibernate? stackoverflow.comam using hibernate merge method, to deal with detached instance from entity, and i thought that the return of this method will be a new fetched instance from database as hibernate ... |
16. JPA/Hibernate can't create Entity called Order stackoverflow.comI'm using Hibernate/JPA and have an @Entity object called Order, pointing at a MySQL database using Hibernate's dynamic table generation i.e. generate tables at runtime for entities. When Hibernate creates the ... |
17. Is there a way to define NamedQueries outside of entity? stackoverflow.comI use Netbeans as IDE and use the wizards to generate Entities. If I want to define custom NamedQueries (not the ones auto generated) how can I define those outside of ... |
18. JPA2 Criteria queries on entity hierarchy stackoverflow.comsuppose i have the following entity domain:
|
19. Hibernate's session-per-conversation & query unflushed entities stackoverflow.comhere's the context :
we are currently writing an application which is web based (flex front end). The server side is implemented with Java, using hibernate for ORM. |
20. In Hibernate Envers is it possible to query ALL entities for a given revision? stackoverflow.comI'm looking at Hibernate Envers to solve two problems for me. First is auditing, fine. Second is the ability to roll-back a change made in a revision. ... |
21. Prevent Hibernate N+1 Selects when grouping by an entity stackoverflow.comI have a Hibernate Criteria object that I build thusly:
This produces a ... |
22. Is the second-level cache support for caching the query result exclude the entity stackoverflow.comNormal query manner:
In this case,the object in the list are "entity"s. They will be cached.
However I wonder if cache would work if the ... |
23. HQL: How to select all entities distinct by some column? stackoverflow.com
|
24. Querying a hibernate entity with two one-to-many collections stackoverflow.comI am selecting a number (x) of entities Foo using Hibernate. Each foo has one-to-many collections bar and baz that are set to lazy fetching. I will need to ... |
25. Hibernate: Unable to find entity which clearly exists, why not? stackoverflow.comI have entity class which is used to model a weather station, and it includes a unique string property "code". I also have an entity class which is used to ... |
26. How to declare named queries oustide Hibernate entity classes? stackoverflow.comI have a data access class that exposes basic operations for an entity class used on a web site:
|
27. How to project instances of the original root entity in a hibernate criteria query as part of the projectionList? stackoverflow.comAssuming a model where A has a collection of B's, and each B has two collections--one of C's and one of D's--I need to count the total number of C's and ... |
28. Hibernate find entities not in a collection stackoverflow.comI have an entity
How can I perform a query that will return all CategoryModel entities that are not in ... |
29. Problem in HQL when try to get count of a property (that is entity) and its value stackoverflow.comIn my project, I have two entity, first PaperEntity contains several properties (consisting of value types and also reference types -reference to other entities-) and second is PaperStatusEntity. PaperEntity has a property ... |
30. HQL: query only base table from |
31. Java EE, EntitiManager Query, SELECT JOINED entities stackoverflow.comThis is what I have (of course in a sintetic form)
|
32. Finding the recently deleted entities using Hibernate envers stackoverflow.comSo my problem is that I need to find all the recently deleted entities of a particular class, that is the entities which have been deleted since a particular timestamp. Specifically, ... |
33. JPA: Query that returns multiple entities stackoverflow.comI'm writing a JPQL query that joins across three tables. In my resultlist I would like to get all three entities per matching row (hope that makes sense). Any ideas? Hibernate 3.x is ... |
34. delete query in JPA2 with related entities stackoverflow.comI'm trying to do a bulk delete
The prbolem is that hibernate translates this to
|
35. problem finiding an entity in a named query stackoverflow.comAny idea on how to make an entity identifyable in a JPQL named query? I have a named query in an entity that references another entity. But on running the query ... |
36. ORM framework compare to direct query in database stackoverflow.comI want to write a program for warehousing. Can anyone guide me to use framework for database layer. I have used entity framework before but I did not enjoyed that because it ... |
37. Hibernate Native SQL Query retrieving entities and collections stackoverflow.comThis is my situation, I have two basic POJO's which I've given a simple hibernate mapping :
|
38. Hibernate entity property defined by a query stackoverflow.comI try to implement document modifications tracking system with Java and Hibernate. Every mod to document is saved with autor and timestamp. To get the creator of document I need to ... |
39. Prevent entity from being created, but need entity for native query stackoverflow.comI have a native query that executes a stored procedure and the results is mapped to an entity, this works fine but the thing is the entity is created in the ... |
40. How to get a distinct user entity in Hibernate for each user address using criteria stackoverflow.comi'm implementing a search routine with hibernate criteria to find registered users. Each user can have one or more addresses. i've build the following structure and i add it the restirctions ... |
41. HQL error with subquery for a related entity stackoverflow.comI've been having problems trying to retrieve a related entity using an HQL subquery. I have three entities: a |
42. HQL NHibernate - "where clause" of a collection of an entity stackoverflow.comI'm using NHibernate 3.2 Here is what i want to do (all atempts failed):
OR
Is it possible to ... |
43. Refresh entities in JPA stackoverflow.comI'm confused about how I should refresh the state of entity that is already in the database. Being more specific, suppose I have "entity" persisted with a code like this:
|
44. JPA native query, group function, different entity coderanch.comHello all, I have got an exciting problem. I have got the following native query: String sql = "select max(nvl(a_date, b_dt)) as max_a" + ", min(nvl(a_date, b_dt)) as min_a" + ", max(c_dt_tm) as max_c" + ", min(c_dt_tm) as min_c" + " from date_table " + " where number " + " between '" + startNumber + "' " + " and ... |
45. Hibernate can't find Entity! coderanch.comcreat the webproject with myeclipse, and added hibernate capabilites, hibernate.properties: hibernate.connection.driver_class=com.mysql.jdbc.Driver hibernate.connection.url=jdbc:mysql://localhost:3306/worklog hibernate.connection.username=root hibernate.connection.password=acc the Java Persistence class is also configurated, its content: package mem; import javax.persistence.*; @Entity @Table public class Member implements java.io.Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue @Column(name="id") private Integer id; @Column(name="username") private String username; @Column(name="password") private String password; public Member() { } public ... |
46. Hibernate execute second select for each entity reference coderanch.comHey, I have Person->Address->*Contacts (collection of elements) (in my model i have heirarchy with more levels). i use the following query: from Person person left join fetch Address address left join fetch address.contacts in the SQL that hibernate generate i notice that it excute select for each person references, so if i load 10 persons it will run 10 selects for ... |
47. JPA Delete Entity and Refresh Collections containing Entity coderanch.comWhat is the best way to delete an entity and then refresh all of the places in the application that have a reference to it? I have two references to a particular entity and when I delete the entity I want the other location updated. Here is the scenario: Entity A has a collection (List) of Entity B (OneToMany). I obtain ... |
48. Hibernate JPQL/HQL: aggregate functions show results of wrong table/entity joined twice coderanch.com|sf.roster.id|ga.id|sf.finalScore|sa.finalScore| |------------|-----|-------------|-------------| | 1| 3| null| null| | 1| 5| 71| 93| | 1| 11| 77| 80| | 1| 13| 65| 71| | 1| 16| 88| 90| | 1| 22| 58| 51| | 1| 23| 71| 75| | 1| 30| null| null| | 1| 32| 89| 86| | 1| 40| 62| 71| | 1| 42| 64| 60| | 1| 46| 73| ... |
49. Static select for entity forum.hibernate.org |
50. Named Query Unknown Entity forum.hibernate.org |
51. Cached query result is not invalidated by entity update forum.hibernate.org |
52. Static select for entity forum.hibernate.orgHello, When starting Hibernate in debug mode I see thousands of statements like the following: [code]2009-12-11 18:16:43,754 DEBUG [org.hibernate.loader.entity.EntityLoader] - Static select for entity be.xyz.DimensieDefinitie: select dimensiede0_.SK as SK1_0_, dimensiede0_.ORM_VERSIE as ORM2_1_0_, dimensiede0_.CODE as CODE1_0_, dimensiede0_.NAAM as NAAM1_0_, dimensiede0_.VALIDATE_DIM as VALIDATE5_1_0_, dimensiede0_.WIJZIGINGSDATUM as WIJZIGIN6_1_0_, dimensiede0_.WIJZINGSAUTEUR as WIJZINGS7_1_0_, dimensiede0_.AANTAL_BUDD as AANTAL1_2_0_, dimensiede0_.AANTAL_AUDD as AANTAL2_2_0_, dimensiede0_.AFLEIDEND as AFLEIDEND2_0_, dimensiede0_.OPTIONAL as OPTIONAL28_0_, dimensiede0_.UD_CLASSNAME as ... |
53. Failed to cached entities already fetched in previous query forum.hibernate.orgI am working on a simple example to illustrate my problem. It consists of two entities, (Contact and PhoneNumber) with a one-to-many relationship between them. Contact -> PhoneNumbers My application queries a set of contacts and their corresponding phone number using a set of complex queries. Once these have been retrieved I am going some further processing and navigate the relationship ... |
54. Hibernate execute second select for each entity reference forum.hibernate.orgHey, I have Person->Address->*Contacts (collection of elements) (in my model i have heirarchy with more levels). i use the following query: from Person person left join fetch Address address left join fetch address.contacts in the SQL that hibernate generate i notice that it excute select for each person references, so if i load 10 persons it will run 10 selects for ... |
55. Entity cache expire clears query cache too. forum.hibernate.orgI have two cache regions set up. One for the Employee entity and the other is for queries. I should say that my query results consist of lists of Employee objects. Problem is, when the entity cache times out, it also clears my query cache. It also does something strange to the query cache because it take 50 secs for the ... |
56. HQL question : entities in 'in'-clause forum.hibernate.org |
57. many-to-one joined produce inserts while selecting an entity forum.hibernate.orgHi everyone, I have a problem with a many-to-one relationship. In fact my mapping works but I don't undesrtand what Hibernate is doing. I have "formation" object, this object can be associated with a "section" and this association contains an attribute "year". Code: CREATE TABLE formations_section ( fu_id INTEGER NOT NULL, sec_id INTEGER NOT_NULL, ... |
58. Entity cache supported for "named queries/stored procs"? forum.hibernate.orgBeginner Joined: Fri Dec 10, 2004 11:46 pm Posts: 37 Hi I'm experiencing this issue when calling a stored procedure. At first it works and then after a few calls it can no longer map the entity. I think it has something to do with caching. The cache expires and then it tries to load the entity directly. The sp is ... |
59. What does Criteria.DISTINCT_ROOT_ENTITY do ? forum.hibernate.org |
60. Query envers for the last revision of all entities forum.hibernate.org |
61. How to reload an entity which was updated through HQL query forum.hibernate.org |
62. Adding projections is turning off my entities forum.hibernate.org |
63. Extract single entity from criteria query result forum.hibernate.orgHibernate and JPA implementation. I am using Criteria query to create dynamic query. My generated query as bellow. select entity1.*,entity2.*,entity3.* from entity1 this_, entity2 entity2_1_, entity3 entity3_2_ where this_.column=entity2_1_.column and entity2_1_.column=entity3_2_.column(+) and this_.xxxxx = ? and this_.xxxxx = ? and this_.xxxxx = ? Collection |
64. Criteria Projections to the root entity forum.hibernate.orgHi, when I use Criteria Projections, then I cannot get root entity anymore. E.g. createCriteria(Employee.class).setProjection(Projections.projectionList().add(Projections.sqlProjection("(SELECT DISTINCT...)", mySQLProj, Hibernate.INTEGER)).add(Restrictions...); Now, I want the result to be a List |
65. Handling new entity creation with an eternal query cache forum.hibernate.orgNewbie Joined: Wed Aug 25, 2010 9:14 pm Posts: 5 I have the following scenario: 1. query cache enabled, query cache region is eternal (never evicts). My query cache is massive (entire db is cached in L2 for performance reasons). 2. queries used in the query cache make strict use of natural identifiers to avoid query cache eviction upon update/delete/insert ( ... |
66. Getting a single entity from a query forum.hibernate.orgpublic class JCMSYearIndicator @OneToMany public List |
67. Session per conversation & query unflushed entities forum.hibernate.orgHi, here's the context : we are currently writing an application which is web based (flex front end). The server side is implemented with Java, using hibernate for ORM. Well, I'm not wrong with the forum I write to. The specificity of this application is that it implements a conversation with the user. That means that the user is opening a ... |
68. Getting the entity name in an HQL query? forum.hibernate.org |
69. JPA2 Criteria API, using Entity as query parameter. forum.hibernate.orgNewbie Joined: Mon Nov 15, 2010 9:54 am Posts: 1 I've been trying to implement QBE (Query by Example) functionality using plain JPA2 spec, while using Hibernate 3.5.5 as JPA2 implementaion. The problem i am stumbled upon is the following: I have implemented GenericDao |
70. how can i get both entity and scalar from hibernate query? forum.hibernate.org |
71. 2 entities returned by a query while only one in DB forum.hibernate.orgNewbie Joined: Fri Feb 18, 2011 2:19 pm Posts: 3 Hi, I've experienced some weird behavior with Hibernate recently and I haven't foudn anything which explains it yet. I have a simple piece of project with 2 classes : Speaker and Talk. A speaker can give multiple talks and a talk can only be given by one speaker. Here is my ... |
72. Distinct Entity Criteria Returns Same Entity N-times forum.hibernate.orgI have an entity which has a relationship with two child collections, as shown here: Parent +-- Child (collection) +-- GrandChild (collection) What I want to have returned is the list of distinct parent entities where the grand child entity contains a property of a specific value. So long as only one of the grandchildren of a specific parent contain the ... |
73. Ejb3Configuration.addPackage() does not find entities. forum.hibernate.orgEjb3Configuration ejbConf = new Ejb3Configuration(); ejbConf.configure("TestPU", null); ejbConf.addPackage("org.jboss.jawabot.irc.ent"); ejbConf.addPackage("org.jboss.jawabot.irc.model"); ... |
74. cached native (scalar) queries with hibernate entity-manager forum.hibernate.org |
75. execute native query that returns entity + another columns forum.hibernate.org |
76. Hibernate doesn't seem to be inserting entities in order forum.hibernate.orgHi there. I have a tree of hibernate objects - it looks something like A -> multiple B's -> multiple C's -> Multiple D's There are times when I create an A, add a B to it, add some C's to B, and then add a D to each C. Then I do session.save(A). This works fine in MySQL, but trying ... |
77. entity's table name for straight SQL query forum.hibernate.orgI'm writing a stad-alone (SWT) application using Hibernate 2.1 + Spring framework 1.0.2. DB is MySQL Server. What I want to do is a "massive" delete of some table's rows. I know that in hibernate I do not have to use session.delete(Collection) because this will try to incarnate all table rows, then delete each single row from the table: this is ... |
78. Entities in group by forum.hibernate.orgNewbie Joined: Tue Sep 07, 2004 4:58 am Posts: 2 In the Hibernate docs at http://www.hibernate.org/hib_docs/reference/en/html/queryhql.html#queryhql-aggregation they show a query like this Code: select cat, count( elements(cat.kittens) ) from eg.Cat cat group by cat However, when I try a query like this (I'm using the hibern8ide to test queries): Code: select composer, count(elements(composer.children)) from Composer as composer group by composer I ... |
79. No variable DISTINCT_ROOT_ENTITY defined forum.hibernate.orgI'm using Hibernate 2.1 with JDK 1.3 ... When I compile a java file with the following line : criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); I get the following error : No variable DISTINCT_ROOT_ENTITY defined in interface net.sf.hibernate.Criteria. criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); Sure enough I peruse the Hibernate 2.1 code and the variable is not defined? What gives? Thanks. em |
80. Prefetch entities using session.find forum.hibernate.org |
81. Basic Query Question with multiple entities forum.hibernate.orgI have a question which I think should be quite easy to answer. I have looked everywhere for an answer and cannot seem to be able to find it partly I am guessing because I do not know the best way to ask the question. I have two entities, a family and a camper which families can have many of. I ... |
82. Deleting entities with the Query API and MySQL 4.1.9 forum.hibernate.orgHi, I am using Hibernate3 and MySQL 4.1.9 Professional. I wanted to delete an entity with the Query API: Query q = sessionFactory.createQuery("delete Entity where id=?"); ... return q.executeUpdate(); However, when executing this, I get a syntax error from MySQL. I pasted the generated SQL and used in another database client and still got the same error. It seems that MySQL ... |
83. got the Unkonw entity error. using Native SQL Query forum.hibernate.orgHi I have a question to use native sql query in hibernate. Is the entity object specified in the native sql query required as the object mapping to the database table ? For example, Query = session.createSQLQuery(sql).addEntity("user", User.class); Must the User.class be the entity class that maps to the database table ? Can user object be any dynamic class type that ... |
84. HQL - querying against entity collection forum.hibernate.orgHi. Here's my scenario. *Class Flavour - String: name *Interface Publishable *Interface Topic - extends Publishable - Collection: Flavour objects *Class DefaultTopic implements Topic *Class Book - Collection: Publishable objects Now I would like to have a Hibernate query where given a collection of Flavour objects, I find all Books which contain one or more Publishables of type Topic, which in ... |
85. Entity class required in createSQLQuery??? forum.hibernate.orgMy SQL Query is: select Q1.paAmount, Q2.pAmount From (select sum(pa.amount) paAmount,pa.BookingID paBookingid from package_acct pa, Groups g , Person_Group pg where .... group by pa.BookingID )Q1 Inner Join (SELECT sum(p.amount) pAmount, p.BookingID pbookingid FROM `payments` p where p.ispaid=1 group by p.BookingID )Q2 on Q1.paBookingid=Q2.pBookingID So I'm selecting on results of 2 other selects innerjoin.It works in mysql. I tried to use ... |
86. Query by example returning wrong entities forum.hibernate.orgWhen querying for orders, the collection returned is a collection of customers, even though when the criteria is created it it is told that we want Orders. This worked under hibernate 2, and stopped working after upgrading. Example exampleOrd = Example.create(ord).excludeZeroes().enableLike(MatchMode.ANYWHERE)..ignoreCase(); Example exampleCust = exampleCust = Example.create(cust).excludeZeroes().enableLike(MatchMode.ANYWHERE).ignoreCase(); Criteria x = session.createCriteria(Order.class); x.add(exampleOrd); x.createCriteria("customer").add(exampleCust); List |
87. Odd behaivor with Criteria.DISTINCT_ROOT_ENTITY forum.hibernate.org |
88. Projections.distinct(?????). Getting the right entity. forum.hibernate.orgEither I am way out of tone or no one has an answer.. I'll bet for the former. I any case.. I am really interested about finding a way around this. I am willing to submit a patch and in fact I already checked out the code and was looking into the posibility of adding a new constructor to Distinct with ... |
89. Criteria mixing projection and entity forum.hibernate.orgIs there any way I can create a Criteria query that return an Entity and a projection at the same time? I want to retrieve an Entity list, and also include a specially calculated field for each one. The special field uses a custom function, which takes a parameter. Adding projections seems to force it into projection mode, and i can't ... |
90. Criteria API and distinct entities forum.hibernate.orgHibernate version: 3.1 My current problem is that I have a query builder that uses the Criteria API to construct a query based on user input. My Criteria query joins to several other tables and specifies a max results. An example of a typical query in HQL that is impossible with the Criteria API is: Code: Query query = session.createQuery( "select ... |
91. SQLQuery, sql-query leads to Unknown entity....why? forum.hibernate.orgNeed help with Hibernate? Read this first: http://www.hibernate.org/ForumMailingli ... AskForHelp I apologize for sounding dense here. I am very new, but, I have read, and read and read. I downloaded the caveatemptor sample. I have downloaded the latest hibernate. I have HQL working fine, and Criteria queries working fine. But I have a nasty union query that in my limited knowledge ... |
92. Returning a non-entity from a named query, return-scalar,etc forum.hibernate.orgHibernate version: 3.1.2 I want to return a non-entity from a named query. That is, the returned objects from a named query are non-entities in the sense that I do not need to persist them. That is because, the named query does an aggregate function (e.g. select sum(), etc... ) However, I am not sure on how to go about this. ... |
93. Query selecting entity property and joining on collection forum.hibernate.orgPage 1 of 1 [ 1 post ] Previous topic | Next topic Author Message doublei2rd Post subject: Query selecting entity property and joining on collection Posted: Wed Mar 22, 2006 5:25 pm Newbie Joined: Wed Mar 22, 2006 4:48 pm Posts: 1 Location: Nebraska, USA I have an HQL statement ... |
94. HQL, subqueries and entity params forum.hibernate.orgHi there, I'm having a small but annoying issue with HQL, subqueries and passing in an entity object as query parameter. Suppose I have two classes: User and Role, where a user points to a set of roles. Given a specific role I would now like to find all users that have that role assigned. I would expect the following code ... |
95. How to check the reference count for an entity forum.hibernate.orgHi, I have an entity A that is referenced by several entity types - lets say B, C and D. I want to enable or disable the delete operation for A if it is referenced by other entities. Is there a light-weight way to do it? I mean, is there a way to know the reference count for entity A without ... |
96. Criteria, Projection and select root entity forum.hibernate.orgno, unfortunately this wont work since Proectsions.property is looking for mapped properties and not alias -> i will get some thing like "could not resolve property car in class Car". i tried the HQL version (select c, max(c.price) from Car c) and this does not work because of some troubles in the group by clause (not in agregate function or groub ... |
97. Member collection of an entity has duplicates after query forum.hibernate.orgHibernate version: Hibernate 3.1.1 Hibernate Annotations 3.1 beta8 This is related to a previous problem i posted. http://forum.hibernate.org/viewtopic.php?t=960677 I have defined 5 classes using annotations as follows. Note that the following members are eager fetched: 1. contactNumbers of the Person class 2. cards of the Membership class Code: @Entity public class ContactNumber { @NotNull ... |
98. selecting only few columns from entity forum.hibernate.org |
99. DISTINCT_ROOT_ENTITY with projections query cache problems forum.hibernate.orgHello all iam trying to execute a simple Criteria Query the query is as follows DetachedCriteria detachedCriteria = DetachedCriteria.forClass(MyClass.class); detachedCriteria.add(Restrictions.lt("day", new Date())); detachedCriteria.add(Restrictions.eq("contentType", "xyz")); detachedCriteria.createAlias("userContent", "userContent"); detachedCriteria.setProjection(Projections.projectionList() .add(Projections.alias(Projections.sum("count"),"sumAlias")) .add(Projections.groupProperty("userContent")) ).addOrder(Order.desc("sumAlias")); detachedCriteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); This query translates to the following pseudo SQL "Select sum(count),content_id from ....group by Content_id order by sum(count)" when i run this with the query cache off it works fine and ... |
100. Criteria Queries: Get entity and additional columns? forum.hibernate.orgIs there a way, using criteria queries to extract an entity as well as additional columns associated with that entity? I'm using Postgres GIS queries to determine the distance of an entity, but I can't seem to get criteria queries to do what I want. If I use native SQL, I can do this: Code: session.createSQL("select {myentity.*}, distance(the_geom, MakePoint(...)) as distance ... |