1. Hibernate Criteria Problem forum.hibernate.orgGuys, Have anyone used the Criteria Object of Hibernate? I have a Member object which has "careers" and "educations" as collections. For querying Members whose Career.A = x careerCriteria = criteria.createCriteria("careers"); careerCriteria.add(...); But I have to query Members just that, either Career.A is "X" or Education.B is "X". Is it possible to add a criteria like that? What do you suggest? ... |
2. Criteria problem, please help forum.hibernate.orgI have a class name employee which has a set of associated parameters. I am trying to get the employees with a specific parameters. When i ask for employes with only one parameters it is working fine, however when i ask for employees with more than 1 parameters, the result is none. Here is my Criteria request. List res = null; ... |
3. Regarding Criteria ? forum.hibernate.orgHi Hibernate Experts, Thanks for Reading. I have one Question. I saw one Criterial Query Like String SQL_QUERY = "select sum(insurance.investementAmount),insurance.insuranceName " + "from Insurance insurance group by insurance.insuranceName"; Ok. In my point of view this Query is looking like Ordinary sql query. 1. My Question is , this Query is Ordinary Query or Hibernate Query? 2. If I change My ... |
4. Assistance needed with criteria forum.hibernate.orgHi! This is my first post and I need some assistance. I could not find an answer searching or reading the documentation. (I am still "new" to hibernate, so please bear with me.) I am using criteria to return limited results. I have no problems with criteria using fields that are varchar2, integer, or an instance of another class. My problem ... |
5. Using Criteria forum.hibernate.orgHello again, I am now trying to do the search using the Criteria class. What I would like to know is how can I search into other tables associated with the class I want to return. I understand that when I put this code: "Criteria searchCriteria = getSession().createCriteria(BaseStudent.class);" it means that when I call the .list() method it will return a ... |
6. criteria question involving nulls forum.hibernate.orgI have a table with a few bits of data and a varchar column called deleted that contains a single character 'Y' or 'N', or null, in the case where for some reason or other nothing has been inserted yet. I am using the Criteria object to create the query like so: Code: ... |
7. Build Criteria Dinamically forum.hibernate.orgIs it possible to build Criteria queries dinamically, like an SQL query? For example, i've this query SELECT name FROM table1 where 1=1 and name = Tom and program=JBOss and address = Lisbon, etc ..., and i want to build a criteria query, but i don't know how many conditions i would have in the Criteria. How i do this? Thanks, ... |
8. What criteria to use when determining to use Hibernate. forum.hibernate.orgLet me start by saying that if we need an ORM tool, Hibernate is my choice. That said, I am in discussion with some colleagues wherein I am taking the position that the needs of our project are not sophisticated enough to pull Hibernate into the mix of new technologies we are applying. I am basing this on the following: Most ... |
9. simple criteria question forum.hibernate.orgDetachedCriteria dc = DetachedCriteria.forClass( Project.class , "p" ) .createAlias( "departments", "depts" ) ... |
10. something about the Criteria forum.hibernate.orgHi I met a problem when I use the class org.hibernate .Criteria my code were as follow: // User user=new User("good"); Example example=Example.create(user) .excludeZeroes() .excludeProperty("password") .ignoreCase() .enableLike(); List result=session.createCriteria(User.class) .add(example).list(); // the problem is when i use the primary key as a filter ,it will get all the rows in the database out,if I use other column else,it will work all ... |
11. Criteria metadata forum.hibernate.orgHi, I'm writing a support library for the geotools projects so that hibernate mapped beans with geometric properties can be drawed onto geographical maps if needed. Now, the details are a bit long, so I won't explain everything, but in short the user will give me DetachedCriteria objects for each map layer he want to depict, and I have to turn ... |
12. Criteria for many-to-one forum.hibernate.org |
13. How to use Criteria in Hibernate forum.hibernate.orgHi, I have a problem while using criteria in Hibernate. The problem I found is when I select max(last_modified_ts) of a particular val_status_id whose submission_id='' and val_def_mod_res_id=''. It is showing error. My table structure look like this: --------------------------- val_status : ------------------ val_status_id raw primary key val_session_id raw foreign key created_ts date last_modified_ts date val_def_mod_res_id raw val_session: --------------------------- val_session_id raw primary key ... |
14. criteria trouble forum.hibernate.orgHi, I'm new to hibernate and I'm facing a trouble while I'm trying to get values with a criteria I've in my hbm the following line who define a relation between my object and an another table Code: |
15. Learn Criteria... forum.hibernate.org |
16. Criteria+Set(Many-to-Many) forum.hibernate.orgI had tried exactly the same things: fetch="subselect"/FetchMode.SELECT to no avail. I think FetchMode.SELECT is the new name for LAZY, i.e., it does additional selects later if needed. We close our Hib session quickly and must always get everything we will need before closing it to avoid a LazyInitEx. I found this forum topic: http://forums.hibernate.org/viewtopic.p ... af59ac91d9 And when I added ... |
17. Help Needed with Criteria by Example forum.hibernate.orgI have a Pojo called Product as follows: Public Class Product{ private ProductPK pk; private String stockNum; private Double price; public Product(){ } //getters and setters below } Note that the Product Pojo has a attribute of type ProductPK. ProductPK represents a composite key. It looks as follows: Public class ProductPK{ private String productCode; private Date operativeDate; public ProductPK(){ } //getters ... |
18. Criteria problem forum.hibernate.orgNewbie Joined: Thu Aug 31, 2006 7:56 am Posts: 14 ansi_c wrote: Hi please post your mapping files. thanks Apologies, I did not include the mapping files cos it was working using hql, here they are.. Code: Mapping files, Order, Rep & RepGroup |
19. help write a criteria code forum.hibernate.orgI have 3 classes. User, RoleRef, Role Code: public class User { public void setId(int id) { ... } public int getId() { return ...; } } Code: public ... |
20. Criteria problem forum.hibernate.orgHi all, im newbie to hibernate, ive just initiate investigating the possibilities, theres a lot of. When im testing ive encoutered a problem (me), ive this mapping of 2 tables : |
21. Multiple Criterias? forum.hibernate.org |
22. Problem in "detaching" a criteria forum.hibernate.orgjava.lang.NullPointerException at org.hibernate.loader.criteria.CriteriaQueryTranslator.getProjectedTypes(CriteriaQueryTranslator.java:317) at org.hibernate.criterion.SubqueryExpression.toSqlString(SubqueryExpression.java:56) at org.hibernate.loader.criteria.CriteriaQueryTranslator.getWhereCondition(CriteriaQueryTranslator.java:333) at org.hibernate.loader.criteria.CriteriaJoinWalker. |
23. Bitwise operation in Criteria forum.hibernate.orgI'm using Hibernate 3.1 and I need to do bitwise operation. I've been using the bitwise workaround found on the forum to use bitwise operations on HQL queries. However, I want to use the criteria API instead of the HQL query. So far, I haven't found how to use any custom function in Criteria. What I'm trying to achieve is something ... |
24. union of two hibernate criteria? Possible? forum.hibernate.org |
25. Little problem with a criteria forum.hibernate.org |
26. Problem with PropertyAccessor and Criteria forum.hibernate.orgHi, I have Objects with an ObjectId class as an identifier. This is mapped to a long in the DB. In the corresponding hibernate mapping I specified a PropertyAccesor in the |
27. Criteria problem forum.hibernate.orgpublic class Author implements java.io.Serializable { private int number; private String name; private Set books = new HashSet(0); ... } public class Book implements java.io.Serializable { private int number; private String title; private Short year; ... |
28. Criteria.setReadOnly? forum.hibernate.orgHi all, A simple question: is it possible to make the results returned from Criteria read-only (i.e., with dirty-checking disabled)? I'm using Hibernate 3.2 and my Criteria query returns a large number of results which won't be modified but only displayed to the user. I want to tell Hibernate not to create snapshots of all these results for dirty checking. There ... |
29. Simple criteria question forum.hibernate.orgHi, Does anyone know how to do this HQL with a criteria in stead: String sql = SELECT cp FROM Company cp, Person ps, WHERE cp.person = ps.id AND ps.cpr = ? List list = getHibernateTemplate().find(sql, cpr); So what i actually want to do is to make a search by associating two entities that are not related in my hibernate mapping ... |
30. getNamedQuery() with Criteria forum.hibernate.orgis there a way to *marry* getNamedQuery() with Criteria queries in Hibernate3, so that one can apply additional constraints on an already defined query on the fly? I tried also to use filters, but as soon as they are gobal session-wide objects, I had to manually enable/disable each of them. That also could lead to some weird consequences if one would ... |
31. Criteria: Many-to-many forum.hibernate.orgHi I've looked for this in the forum (and google, ..), but I have not found something that solves my problem. Maybe I cannot find the right thing, because I do not know what to look for. I have following Problem (simplified): Class A { Set bs; //set of Bs .. } And I am searching for all As with several ... |
32. How to do rand() in Criteria? forum.hibernate.orgFirstly, hi. I'm new at using hibernate and criteria(and all the stuff), and I have came across this little problem, I need to get one single record of my DB and it need to be a random one. I would know how to do it in SQL but I have no idea using Criteria. Any help? Thank you in advance. |
33. Multi-criteria problem forum.hibernate.org |
34. about Criteria using ... forum.hibernate.org |
35. EmptyInterceptor onPreparedStatement doesn't work Criteria forum.hibernate.org |
36. How to use Criteria forum.hibernate.orgYou can use either Criteria or HQL (Named Queries) HQL is powerfull with advanced features and usefull for more difficult problems. Criteria allows you to built a query at runtime. But criteria are often less readable then HQL but are validated at compile time. A Criteria is a tree of Criterion instances. (Restrictions return criterion instances). For example: Criteria criteria = ... |
37. Help With My Criterias forum.hibernate.org |
38. Need help with Hibernate Criteria forum.hibernate.orgHi All, I need a little help with Hibernate Critieria. I have the following classes: public class Bottle{ private Long id; ... ... } public class BigContainer{ private Collection allBottles; ... ... } public class RedContainer{ private Collection redBottles; ... ... } I need a Hibernate Crieria to find all the bottles from BigContainer.allBottles that do NOT contain RedContainer.redBottles. I am ... |
39. Criteria parsing forum.hibernate.orgHi, how can i parse a Criteria object which contains some levels of Subcriterias in it? I can get all the Subcriterias of a Criteria, but how to get all the Subcriterias from a Subcriteria? And eventually hot to get all the restrictions which are applied on a certain Subcriteria? Please advice. |
40. Many-to-Many criteria problem forum.hibernate.orgHello, the last weeks I tried to build a Criteria that queries many-to-many associations, without success. I have USERs, ROLEs and USER_ROLEs where USER_ROLE is the jointable. I want to build a Criteria that gets me all USERs containing a number of ROLEs at the same time (for example 2 or more). The following attempt does not work properly, because it ... |
41. Criteria question forum.hibernate.org |
42. Criteria question forum.hibernate.orgCriteria criteria = session.createCriteria(Username .class); criteria.add(Expression.eq("username", userName)); List result = criteria.list(); for (Iterator iter = result.iterator(); iter.hasNext();) { ... |
43. Criteria and type boxing forum.hibernate.orgHi all I'm building a framework using Struts and Hibernate. I am trying to automate a search form. Basicly, in my form, the field name is a column name of my persistant object, whereas the value is the criteria value. Once I submit the form, I build a map, the key is the column name and the value is the value ... |
44. what's wrong with my Criteria..? forum.hibernate.org |
45. Criteria error forum.hibernate.org |
46. hibernate criteria forum.hibernate.orgHi, I am using Hibernate criteria for search purposes. I have an option to search the objects using its id.(primary key). This id search should be like search and not exact search. i.e If i give 1, then all objects having key start with 1 should be displayed. In my pojo this id is Long. (if i concat % to this ... |
47. Criteria forum.hibernate.org |
48. criteria interface forum.hibernate.org |
49. OR with multiple Criteria trouble forum.hibernate.org |
50. Criteria question forum.hibernate.orgApologies for the cross post, but this one's relevant to all hibernate users as well as nhibernate so thought you might be able to help ... Can anyone suggest any simplification for the following query? I'm looking for people who have an address in paris and an address in london. Query is currently so complex to avoid searching for 'person with ... |
51. Problems with Criteria: Restricitions.isEmpty(...) forum.hibernate.org |
52. how to add one criteria to another criteria forum.hibernate.orgHI All, i am using two criteria's. i want to combine these two criteria's to one criteria. please let me know how to do. actually what i did? Criteria schdlInstanceCriteria = session.createCriteria(ReportScheduleInstance.class,"scheduleInstance") .createCriteria("scheduleInstance.report", "report") .createCriteria("scheduleInstance.clientCompany", "clientCompany") .setProjection(Projections.projectionList() .add(Projections.property("scheduleInstance.reptSchdlInstanceId")) .add(Projections.property("scheduleInstance.isScheduled")) .add(Projections.property("scheduleInstance.reptScheduleDesc")) .add(Projections.property("clientCompany.clientCompId"))) .add(Restrictions.eq("scheduleInstance.isScheduled", new Integer(reportSearchVO.getGeneratedMethod()))) .add(Restrictions.eq("report.reprotDefId", new Long(reportSearchVO.getReportId()))); if(reportSearchVO.getCompanyNumber()!= 0 ){ Criteria accountCriteria = session.createCriteria(ClientAccount.class,"clientAccount") .createCriteria("clientAccount.clientCompany", "clientCompany") .add(Restrictions.eq("clientCompany.companyNumber", new Long(reportSearchVO.getCompanyNumber()))); if(reportSearchVO.getAccountNumber()!=0){ accountCriteria.add(Restrictions.eq("clientAccount.clientAcctNum", ... |
53. help w/ Criteria forum.hibernate.org |
54. Adding criteria to many-to-many forum.hibernate.orgHello, I have searched the internet and this forum, but haven't been able to find some hints to get things done. So, here it goes: I have this situation. - Table 'Articles' - Table 'Categories' - Jointable 'Article_categories' The relation between articles and categories is a many-to-many. Easy to map this. The class Category has a method getArticles that returns a ... |
55. Criteria question forum.hibernate.orgHi All, I am relatively new to hibernate and having a few problems with implementing criteria. I want a query smiliar to: FROM T1 WHERE (x=1 and x2=1) OR (y=1 and y2=1). Code: List test = session.createCriteria(T1.class) ... |
56. Deepcopy of Criteria forum.hibernate.orgHi, I am working with HibernateCritera API on a quite simple problem: "Find the sum of all positive values and find the sum of all negative values in a table" ... i get the Criteria from the framework to determine the intersection of the table. the simple approach: Code: Criteria c1 = criteria.getExecutableCriteria(s); ... |
57. multiple criteria's forum.hibernate.orgHI, I am new to hibernate. I have a scenario where i would like to use multiple criteria's. I have a map where i will be popping up the elements and try to AND them / OR them. So, is their a better way than using criteria because when we use criteria we need to give it a session. But, i ... |
58. hibernate criteria for ipaddress subnet forum.hibernate.orghi everyone, I have a situation where i have to search in database for an IP_ADDRESS column, which contains 1000's of ipaddress. An example of ip address is 157.198.156.45 in this ip address the third octet is called C subnet. So, the condition here is that i have to write a hibernate criteria so, that we have to count the no.of ... |
59. Criteria "or"ing in a loop forum.hibernate.orgpublic String searchPatient(String patient){ String sql = "select * from PATIENT where "; String names[] = patient.split(" "); for(int i = 0;i < names.length ;i++){ sql += "upper(PATIENT_NAME) like '%" + names[i].toUpperCase() + "%' OR upper(PATIENT_SURNAME) like '%" + names[i].toUpperCase() + "%'"; if(i+1 !=names.length) sql += ... |
60. Hibernate - Creating Criteria forum.hibernate.org |
61. Universal quantifier (forall) using criteria forum.hibernate.orgHi, is there any way to simulate universal quantifier (for all) using criteria? E.g. I have object Employee and Task in OneToMany association. Employee 1 ----- * Task Task has status attribute. I would like to select all Employees, which have all their tasks in status DONE. Easiest way to do this is rewrite FORALL Condition to NOT EXISTS (NOT Condition) ... |
62. is that possible with criteria ? forum.hibernate.orgHi I need to know if it's possible within criteria queries to create a query that meet the following needs I've an entity affaire that have a communes relations and these commune have a relation to district how to access to affaire.communes.district.libelleFr like '%Toto%' I've tryed to first create a criteria within the affaire object then create a criteriera for the ... |
63. criteria and set forum.hibernate.org |
64. Criteria question forum.hibernate.orgHi, I'm using hibernate through grails, and aksed this question on the grails mailing list, but no answers. Maybe somebody here can help me. I'm trying to do the following sql query using gorm/hibernate criteria: select k.* from kandidaat as k where exists ( select 1 from reactie where reactie_tekst = 'gereageerd' and kandidaat_id = k.id ); I'm using the isNotEmpty ... |
65. Trying to create "rollup" using Criteria and Proje forum.hibernate.org |
66. design question regarding criteria and disjunctions forum.hibernate.org |
67. Criteria question forum.hibernate.org |
68. How can I express this in Criteria forum.hibernate.orgThanks for your answer alexandrubarbat, these are my mappings. (I have the mappings you said.) |
69. Criteria reverse reference forum.hibernate.orgHi, I have two classes class Product { Integer id; } class Characteristic { Integer id; @ManyToOne Product product; String type; } I want to select products which have characteristic.type="foo" SELECT product.* INNER JOIN characteristic on ( characteristic.product_id = product.id ) WHERE characteristic.type="foo"; Can i do this via Criteria API? The method riteria.createCriteria("...") won't work. |
70. Hibernate Criterias forum.hibernate.orgcrit.add(Restrictions.like("prodName", "%" + s + "%")); crit.add(Restrictions.like("prodCode", "%" + s + "%")); crit.add(Restrictions.like("prodDescription", ... |
71. Criteria Help forum.hibernate.org |
72. Issue with parenthesis in criterias forum.hibernate.orgpublic List findByInstitutionName(String institutionName) { DetachedCriteria searchCriterias = DetachedCriteria.forClass(Institution.class); if (StringUtils.isNotBlank(institutionName)) searchCriterias.add(Restrictions.eq("institutionName", institutionName).ignoreCase()); searchCriterias.addOrder(Order.desc("id")); return getHibernateTemplate().findByCriteria(searchCriterias); } ... |
73. Set containment: how to use Criteria forum.hibernate.orgpublic class Merchant { public enum Service { A, B, C, D, E, F, } @CollectionOfElements(fetch=FetchType.LAZY) @JoinTable(name = "Merchant_Service", joinColumns = {@JoinColumn(name = "mId")}) @Column(name="service", nullable=false, columnDefinition="smallint(2)") @Enumerated(value=EnumType.ORDINAL) public Set |
74. criteria's strange behavior forum.hibernate.org |
75. Hibernate criteria question forum.hibernate.orgHi guys I have an object say Basket that has a collection of Fruit which is a super class of Apple and Orange. What I'm trying to do is fetching a Basket with all of its Fruit objects initialized so I don't get class cast exception with polymorphism and proxy obj when doing something like (Apple)(basket.getBasketFruits().getIterator().next()) ; And consider the following ... |
76. Hibernate Criteria forums.oracle.com |
77. calculate an addition with hibernate criteria forums.oracle.com |
78. Regarding Hibernate Criteria forums.oracle.com |