1. hibernate order by association stackoverflow.comI'm using Hibernate 3.2, and using criteria to build a query. I'd like to add and "order by" for a many-to-one association, but I don't see how that can be done. ... |
2. Hibernate Criteria query with restricted associations stackoverflow.comThe use case here is to find some restricted set of Boys who have Kites with lengths in a certain range, and then optionally retrieve all of the Kites in that range belonging ... |
3. Hibernate Avoiding n+1 queries - second level associations stackoverflow.comI have a main table T1 which has a one-to-many relation with table T2 which inturn has a one-to-one relation with table T3. When I try to fetch the data from all ... |
4. How to sort through an association table in hibernate? stackoverflow.comGiven a representation of database tables where two entities are connected through a join table, is it possible to sort on the other entity specifying the sort order somehow through annotations? ... |
5. Java - Hibernate - Query - Association stackoverflow.comI have three classes -> Metadata, MetadataValue and MetadataMetadataValue: Metadata
|
6. Hibernate Criteria query on association stackoverflow.comHow would I go about executing the following Hibernate query using the criteria API. I have an object Parent with List children. I would like to search through all parents and find ... |
7. How to query across many-to-many association in NHibernate? stackoverflow.comI have two entities, |
8. Query a Hibernate many-to-many association stackoverflow.comIn Hibernate HQL, how would you query through a many-to-many association. If I have a Company with multiple ProductLines and other companies can offer these same product lines, I have ... |
9. Restrict the class of an association in a Hibernate Criteria query stackoverflow.comI have an object, 'Response' that has a property called 'submitter'. Submitters can be one of several different classes including Student, Teacher, etc... I would like to be able to execute ... |
10. Avoiding n+1 selects with Cached Hibernate Associations or Caching Collections as a whole stackoverflow.comI've got a one-to-many relationship: Parent record with n Child records. These records are frequently used and read-only and are good candidates for caching. Here is an approximation of my Hibernate mapping:
|
11. How to write a HQL query for Many To Many Associations? stackoverflow.comI have 3 tables, |
12. Traversing associations inside of a Hibernate Criteria OR query stackoverflow.comI have two objects that look something like this:
I would like ... |
13. Hibernate - help with a criteria query on tables with associations stackoverflow.comI am creating a search function in my application and I am having trouble with the Hibernate criteria query to get it working. My model set up looks as follows.
|
14. JPA 2.0 / Hibernate custom join clause on association stackoverflow.comI would like to associate 2 entities using hibernate or JPA 2.0 annotations with a custom join clause. The clause is not the usual FK/PK equality. In SQL this would be ... |
15. JPA 2.0 / Hibernate custom join clause on association stackoverflow.comI would like to associate 2 entities 1:n using hibernate or JPA 2.0 annotations with a custom join clause. The clause is not the usual FK/PK-association. In SQL this would be ... |
16. hibernate session query with one side of an association specified stackoverflow.comI need to write a query to do the ffg: Return a person object based on a child id...the child class has a ref to the parent, but the parent does ... |
17. Hibernate, Associations not working stackoverflow.comI have a model like this Seizurs => MatCountry => MatCountryI18n When I try to query the data like so
and get the data ... |
18. Querying many to many association where the entity doesn't have a certain value using Hibernate Criteria API stackoverflow.comI got two classes User and Role which are mapped to each other using a many to many associations. Now I'm trying to query all users which doesn't have a certain ... |
19. Hibernate: Query By Example equivalent of association Criteria Query stackoverflow.comI'd like to search my data source for all object instances based on the values of an object related by association. The data model can be simplified to: object of type ... |
20. How to sort set created via association in Hibernate coderanch.comHi, I have been banging my head on the wall for some time trying to figure out how to do this. Here is the setup: 2 tables + association join table Contacts Companies Contact_Companies_Map Primary key in each table is an ID field. The Contact_Companies_Map table has two columns. They have foreign key constraints to the Contacts and Companies tables to ... |
21. Problem with Hibernate Criteria, Projections and associations coderanch.comHi, i have the following HQL and want to create an equivalent Criteria: Query query = sessionFactory.getCurrentSession() .createQuery("select " + "person.id as id, " + "person.namenskuerzelIntern as namenskuerzelIntern, " + "person.titel as titel, person.name as name, " + "person.vorname as vorname, " + "person.ort as ort, " + "person.anrede1 as anrede1" + " from Person2 person"); query.setResultTransformer(Transformers.aliasToBean(Person2.class)); Person2.java: public class Person2 ... |
22. Projection not working for associations forum.hibernate.orgI have a Contact class with the following properties: private long objectId; private String firstname; private String lastname; private String middlename; private String companyName; private String title; private String suffix; private Date anniversary; private Set |
23. Projection not working for associations forum.hibernate.orgI have a Contact class with the following properties: private long objectId; private String firstname; private String lastname; private String middlename; private String companyName; private String title; private String suffix; private Date anniversary; private Set |
24. Problem with Hibernate Criteria, Projections and association forum.hibernate.orgNewbie Joined: Fri Sep 11, 2009 10:15 am Posts: 8 Hi, i have the following HQL and want to create an equivalent Criteria: Code: Query query = sessionFactory.getCurrentSession() .createQuery("select " + ... |
25. Order association collection before passing it. forum.hibernate.orgHi, I am having association in pFieldSet.hbm.xml: |
26. Order association collection before passing it. forum.hibernate.orgHi, I am having association in pFieldSet.hbm.xml: |
27. n+1 selects problem for One-to-One association forum.hibernate.orgHello all, I have this simple One-to-One association: Master entity: Code: @Entity @Table(name = "master") public class Master implements java.io.Serializable { @Id @Column(name = "ID", unique = true, nullable = false, precision = 9, scale = 0) private int id; @OneToOne(fetch = FetchType.LAZY, mappedBy = "master") private Detail detail; public Master() ... |
28. Many association for a table - Join like? forum.hibernate.org |
29. Association Order By forum.hibernate.org |
30. Using query cache I get an empty association forum.hibernate.orgHi I'm starting to work with the Query Cache using Hibernate 3.3.2GA. I enabled the second-level cache and the query cache and set the cacheable property to true. I do a test where I query an object with an association. The second time I query the same object I get the object but the association is empty. Regards, Nstor Boscn |
31. Associations not found in a JOIN causing additional SELECTs forum.hibernate.org |
32. Ordering collections in a many-to-many association forum.hibernate.orgpublic class students{ private List |
33. criteria query using joins and unidirectional associations forum.hibernate.orgHi, we use criteria queries in conjunction with our generic backend so each DAO has its set of extra criteria queries for making complex searches. there i stumbled across the following problem: given 2 classes: PriceModel and PriceListItem class PriceModel{ @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL) private Set |
34. Order by count of association forum.hibernate.orgI am still having issue with this topic. So, here are some more details so perhaps someone can give me literal syntax for my situation. - Define Class Person and Shoe - Add Collection to Person type called 'Shoes' that is a one-to-many of type Shoe Criteria crit = session.createCriteria(Person.class); crit.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); crit.setFirstResult(pageNumber * pageSize); crit.setMaxResults(pageSize); result <- crit.list(); I would like ... |
35. help with constructing a query with criteria on associations forum.hibernate.orgNewbie Joined: Mon Apr 04, 2011 3:41 pm Posts: 12 Hey Folks, I'm having trouble constructing a Hibernate query and I'm hoping to get some assistance here. :) I have an object named FlashCard which has associated objects named Tags. A FlashCard can have one or more Tags (kind of like a Delicious bookmark can be assigned multiple tags). I'm trying ... |
36. Pagination of Associations forum.hibernate.org |
37. Strange results with Order By on many-to-one association forum.hibernate.org |
38. Partial selection of a one-to-many association forum.hibernate.orghi. i've been using Hibernate 2.1.1 for some months and facing some refactoring in the way the queries are performed in the application. i have a one-to-many association from User to Purchase (one user can have several purchases). at the very beginning the approach was a lazy initalized set of purchases in the User class, but since a User may have ... |
39. Order results based on column in association table forum.hibernate.org |
40. GROUP BY a many-to-one association forum.hibernate.orgI'm unable to get this to work: sales.by.region.mtd = \ select \ sls.location, \ max(sls.salesDate), \ sum(sls.sales), \ sum(sls.costOfGoodsSold), \ sum(sls.transactionCount), \ sum(sls.lastYearsSales), \ max(sls.budgetedSales), \ max(sls.salesDaysInMonthToDate) \ from com.fubar.DailyLocationSales sls \ where sls.salesDate between ? and ? \ and sls.location.region.id = ? \ group by sls.location sls.location is defined in the mapping file for DailyLocationSales as |
41. Query on association forum.hibernate.org |
42. association query questions forum.hibernate.orgWe are using 2.1.4. I am using QBC for querying. It works great for a single table and one to many off that table. I have a few many-to-many relationships off this main table. It is a normal association. Person - linktable - Country table. The person can have many countries and countries can belong to many people. I have a ... |
43. Hibernate not finding class in association forum.hibernate.org |
44. Not initializing one-to-one associations with Criteria query forum.hibernate.orgBank.address (n:1) (1:1) Address.bank Address.country (n:1) ... |
45. Using ordered many-to-many associations with JDK 1.3 forum.hibernate.orgHi! I need to work with many-to-many associations with JDK 1.3. In the documentation I have read that the orderedSet functionality with the order-by attribute (resp. the sort attribute) is only available with JDK 1.4. Is there a possibility with JDK1.3? In Hibernate in Action, it is mentioned that ordered bags are possible with all JDK versions. But it is not ... |
46. query with many-to-many association forum.hibernate.orgI have a many-to-many association, and i want to retrieve all the item ids that are in a list of categories. I tried this: "select item.id from Item item where elements(item.categories) in (:categories)"; and then.. List categories =...; // list of category objects query.setParameterList("categories", categories); But I have an exception with the jdbc driver ( i am using jaybird jdbc driver ... |
47. Query unidirectional associations forum.hibernate.orgHi Community, I'm testing hibernate as an replacement for our current selfmade persistence OR-mechanismn. For now, most works great but the devil is in the details. The (web-)applications we build depend heaviliy on existing components (user/security-management, forum etc.). These objects are packaged in a reusable application-independent jar-file (e.g. a standard User-POJO with its corresponding user.hbm-mapping, see mapping). Here is my question: ... |
48. Query by Example with associations forum.hibernate.orgHi, I'm not completely clear on this, but from the debugging I've done, and from looking at this forum, it appears that query by example doesn't pay attention to associations. So if I do: Code: MyFoo foo = new MyFoo(); MyBar bar = new MyBar(); foo.setID(1); bar.setFoo(foo); Example ex = Example.create(bar); List bars = dbSession.createCriteria(bar.getClass()).add(ex).list(); where the mappings for MyFoo and ... |
49. Ordering collections in a many-to-many association forum.hibernate.orgNeed help with Hibernate? Read this first: http://www.hibernate.org/ForumMailingli ... AskForHelp Hibernate version: 3.0.5 Mapping documents: [code |
50. Criteria API Query By Example with multiple associations forum.hibernate.orgNewbie Joined: Tue Jul 05, 2005 3:23 pm Posts: 2 Hello, I am attempting to do a Query By Example (QBE) criteria using a class that has two many-to-one associations. I want to use QBE to place criteria on the class, and I want to use QBE to place criteria upon the two associated objects. Hibernate version: 3.0.5 The class is ... |
51. many-to-many associations in criteria queries forum.hibernate.orgHibernate 3.0.5 Hi, I have a uni-directional many-many relatonship using join-table defined in the following way. Client and Module have many-to-many relation via client_modules table. |
52. many-to-many associations and subqueries forum.hibernate.org |
53. unidirectional 1:1 association, join table, additional query forum.hibernate.orgHi all, I try to figure out the following: A class A (attributes a_id, b) has a 1:1 association (unidirectional) to class B (attribute b_id). The association is persisted in a join table AB (attributes a_id, b_id, discriminator). The 1:1 association can be found with the aid of the discriminator (lets say discriminator must be 'X'). The incomplete solution (for the ... |
54. Querying an uni-directional one-to-many association forum.hibernate.orgHello, I am using Hibernate in an e-learning system to make learner models persistent (extracts of the class definitions and mapping to a relational model are included below). Development have been a bit painful --since I am not and expert on databases nor the Hibernate manual is particularly clear at points-- but have been moving for a while: models can be ... |
55. Querying many to many association returns mangled result forum.hibernate.orgBeginner Joined: Wed Oct 19, 2005 3:30 pm Posts: 25 I switched to using simple sets of strings rather than many to many associations because of this problem. The query (and my program) work perfectly but I really need that many to many association. When I switch back to using the many to many (its an easy change, dont even have ... |
56. "order by" on the property of an association forum.hibernate.org/** * * @hibernate.joined-subclass * table = "ACC_PERSON" * @hibernate.joined-subclass-key * column = "PK" */ public class PersonImpl extends AbstractAccount implements Person { /** * @hibernate.many-to-one * column = "FK_COMPANY" * not-null = "false" * not-found = ... |
57. Ordering with Association-Tables forum.hibernate.orgHi all, i'm sitting here on a pretty weird problem and could need some help or ideas. I have two model classes (Course and Participants) and one association class (takes_part) for storing many-to-many links with additional attributes. The structure is as follows: Course --- many-to-one ---> takes_part <--- many-to-one --- Participants Now it is that i need to get the participants ... |
58. How to sort set created via association in Hibernate forum.hibernate.orgHi, I have been banging my head on the wall for some time trying to figure out how to do this. Here is the setup: 2 tables + association join table Contacts Companies Contact_Companies_Map Primary key in each table is an ID field. The Contact_Companies_Map table has two columns. They have foreign key constraints to the Contacts and Companies tables to ... |
59. Hibernate Query + Associations forum.hibernate.orgHello friends, I need your help with the following. I have the following tables Table A (a1, a2, ab) - a1 is the key, ab is foriegn jkey for table B Table B (b1, b2, ab) - ab is the key Table C(c1, c2, c3) I want to use hiberate to come up with a query like this select A.a1, A.a2, ... |
60. Advice pls :order-by for other end of one-to-one association forum.hibernate.orgI'm pretty sure that it's not possible to do that in the mapping file, unless you switch from using |
61. Help with Criteria query and several associations forum.hibernate.orgNeed help with Hibernate? Read this first: http://www.hibernate.org/ForumMailingli ... AskForHelp Hibernate version:3.1.1 Hi All, I want execute a query with several join with the Criteria API but I don't have the same result than a HQL query. see below the code with HQL query Code: Query query = getSession() ... |
62. Find By Example should follow Associations forum.hibernate.org |
63. many-to-one association not refreshing forum.hibernate.orgHi, I have a Order class that contains a property called "statusId". The Order class also has a property called "status" that associates to another table which stores statusIds and corresponding status names. On my jsp page, I display a bunch of orders and each order has a button that cancels the order. Also next to each order is the status ... |
64. Inefficient criteria query with polymorph association forum.hibernate.orgHi, in my model I do have a Presentation class that does refer, using ManyToOne, a PowerSystemResource class, which is the root of an inheritance hierarchy with 28 subclasses (and it may grow further), mapped with the table per subclass approach (subclasses do have many attributes). Now, I'm trying to get out all Presentation objects attached to a particular type of ... |
65. SubQuery an Criteria problem whith association forum.hibernate.orgHello, Imagine you have two tables A table Parent and a table Child How can I have All the parents they have a child who's name is Jhon ant an other child who's name is Jack ? Parent and child are mapped whith one-to-many association. I tried .createCriteria(Parent.class). .createCriteria("ChildList") .add(Restriction.conjonction() .add(Restrictions.eq("name","Jhon") .add(Restrictions.eq("name","Jack") ) But it don't work. Thank you for your ... |
66. Querying associations forum.hibernate.orgHi I have this: public class Parent { int id; Set childs; public void addImMotherOrf(final Child child) { getChilds().add(child); child.setMother(this); } public void addImFatherOf(final Child child) { getChilds().add(child); child.setFather(this); } //plus all the setters and getters } public class Child { int id; Parent mother; Parent father; //plus all the setters and getters } Now, I like to query the childs ... |
67. How to create an association without SELECTing the referent forum.hibernate.orgHi, I'm trying to improve performance a bit in a perhaps slightly unique circumstance, and I'm wondering if there's a way to make Hibernate do what I need. I am creating new records in table A, which contains many foreign keys referring to various other tables. All of the Hibernate mappings are in place and working fine. The data that I ... |
68. many-to-many associations and criteria queries forum.hibernate.orgpublic List getAllByKeyword(Keyword key) { Criteria criteria = getSession().createCriteria(Member.class). createCriteria("keywords", CriteriaSpecification.INNER_JOIN ). add( Restrictions.eq("id", new Long(key.getId()) ) ... |
69. Association Not Mandatory In Query By Example forum.hibernate.org |
70. Restrict association queries forum.hibernate.orgHi everyone, I am facing a problem that I am not able to solve, thus I am asking this forum. I hope you can help me out of this: I am havong a pretty simple scenario: I have products that are linked to a category. Each product can only be assigned to one category, thus we are talking about a 1:n ... |
71. Querying an entity on multiple associations forum.hibernate.orgI am pretty new to hibernate and am having trouble working this out. I want to query for an entity where that entity has multiple associations which I want to specify as the criteria. These associated entities are not necessarily exhaustive. IE. It may have more but as long as it has those specified return it. Eg. * from order where ... |
72. Criteria Query - one-to-many associations forum.hibernate.org |
73. Association entities are not retrieved in the right order forum.hibernate.orgNewbie Joined: Wed Feb 06, 2008 10:06 am Posts: 14 Hi there, I'm working under Hibernate 3.1.3, in a Java 5 EE Application I have an entity called REFERENCE and one called PASSAGE_POINT. A Reference has one or more PassagePoint. The PassagePoint for a given Reference are sorted according to the delayAfterDeparture (DELAY_AFTER_DEPARTURE) member in PassagePoint. Here is my two mapping ... |
74. n+1 selects in birectional one to one association forum.hibernate.orgI have a class A which has an object of Type B.A is associated with B with a one to one mapping and the association is bi-directional.In table A I have the id of B say for eg "b_Id" The problem is that when I try to Query using HQL "from A where some condition....",hibernate is generating sql "select * from ... |
75. Query Speed with Join Associations forum.hibernate.org |
76. Querying Unidirectional Set Based Association forum.hibernate.orgI have a situation that is identical to the unidirectional Set based association described here. I have a question regarding querying the association. Here's my question: Using the example above, how would I write the HQL to return a Collection (Set, List, whatever) of Events for a particular Person, but only for those Events where the event.active property is true. So, ... |
77. Associations query forum.hibernate.orgHello all, I ve recently started working on Hibernate. I have queries related to persisting collections and their associations. My application has two POJOs FacilityBean and FloorBean mapping to entities Facility and Floor. FacilityBean has a set of floors as i want the set of floors associated with the facility to be retrieved along with it. And Floor has a Facility ... |
78. Querying Many to Many Association forum.hibernate.org |
79. Query many to many association forum.hibernate.orgDatabase: MySQL (InnoDB) Hibernate version: 3.2.6 JDK 1.5 class A{ // @ManyToMany(cascade = {CascadeType.PERSIST, CascadeType.MERGE}) @JoinTable( name = "a_b", joinColumns = {@JoinColumn(name = "a_id")}, inverseJoinColumns = {@JoinColumn(name = "b_id")}) private Set bs = new HashSet(); // } class B{ // @ManyToMany(cascade = {CascadeType.PERSIST, CascadeType.MERGE}, mappedBy = "bs") private Set as = new HashSet(); // } Now in the dao i am ... |
80. Querying Many-valued entity associations forum.hibernate.org@Entity public class Book extends BaseModel { @NotNull private String title; private String description; @OneToMany(mappedBy = "book", cascade = CascadeType.ALL) private List |
81. find obj based on multiple many-to-many association criteria forum.hibernate.orgLets say I have a Book object with a many-to-many association of Authors. I want to find all Books that have *both* Author A *and* Author B in their Set |
82. Is Hibernate able to query associations? forum.hibernate.org |
83. Is Hibernate able to query associations? forum.hibernate.orgHi there, Im currently working on a project using hibernate to access our database. So far I like hibernate very much. Now I have the following problem and hope anybody can help me on this. I have two classes which are associated with one-to-many. My object tree looks similar like this: ProductList |- id |- name |- Products (0..*) |- id ... |
84. with-clause not allowed on fetched associations forum.hibernate.orgExact same problem here as well. Trying to avoid using native query if at all possible. Ran into same problem trying to left join using a Criteria in Hibernate 3.3. In Hibernate 3.5 there's createAlias(String associationPath, String alias, int joinType, Criterion withClause) which, in theory, should be able to do what you're looking for. Note: I haven't tried to see if ... |
85. Problem with accessing association using Criteria Query forum.hibernate.org |
86. NOT IN query - missing association forum.hibernate.orgI've been away from this for a long time. Can someone help me out with this? I have the following objects: Project (with a HashSet called folders) Folder And the following tables: project folder project_folder I want to obtain all folders that do *not* belong to a project. Basically, where folder_id does not exist in the project_folder table. Is HQL the ... |
87. criteria: rowCount Projection ignores fetched associations? forum.hibernate.org |
88. Projection of an implicit association forum.hibernate.org |