like « Query « JPA Q&A





1. Hibernate-like framework for C++    stackoverflow.com

I am looking for database-caching framework for C++ providing the following:

  • Generate object/table representations via some pseudo-language (macros/templates)
  • Retrieve objects from DB by key when needed
  • LRU caching
  • Immediate and delayed update of DB on ...

2. Something like "contains any" in HQL    stackoverflow.com

The following (simplified) classes are mapped to the database via Hibernate:

class SystemUser {
    Set<UserGroup> groups;
}

class UserGroup {
    Set<Integer> permissions;
}
How can I select all SystemUsers with ...

3. Hibernate-like framework for Actionscript-3    stackoverflow.com

With flash and SQLite being supported on the new tablets and smartphones. Is there a database abstraction layer similar to hibernate for java but written in ActionScript3 that supports SQLite? I would rather ...

4. JPA/Hibernate - InheritanceType.JOINED behaves like InheritanceType.TABLE_PER_CLASS    stackoverflow.com

I'm trying to implement a very simple inheritance model in Hibernate. Basically I have a single superclass which can be called A, and several subclasses all of which inherit from ...

5. How to create an 'instance of' -like query in JPA 2.0?    stackoverflow.com

Say we've got an abstract @Entity Animal, and several entity classes that extend Animal, including Dog, Cat, Monkey and Bat. How can I filter the results based on the extending entity's class? Example: There ...

6. Template Wicket app using JPA and Devise-like authentication?    stackoverflow.com

I intend to use Wicket for a university project. I come from a Rails background and so am used to having handy gems that really speed up initial development. I've also ...

7. "like clause" in HQL?    coderanch.com

9. HQL + LIKE + _    coderanch.com

How about adding another phrase like "... AND NOT LIKE '%_%'"? Or -for better performance- work with the SQL equivalent of String.indexOf. Or are there other special characters you want to exclude as well? By the way, please don't ask for answers from specific people. It makes others -who may have more to contribute- feel excluded and unwelcomed.





10. Why is JPA used with in Combination with ORM like Hibernate    coderanch.com

Hi RaviNada, as the name - Java Persistence API - suggests JPA is just the API and specification. The idea behind this is that you can use different implementations as long as they are compliant to the spec. Hibernate is one possible persistence provider for the JPA (although Hibernate can be used without JPA). This way if you create code which ...

11. HQL like clause    coderanch.com

12. How to join 3 tables like this by Criteria Query?    forum.hibernate.org

Hi, all The SQL is select * from table_a a, table_b b, table_c c where a.column_a = b.column_a and b.column_b = c.column_b and c.column_c = a.column_c Now my code is: CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery query = cb.createQuery(TableA.class); Root root = query.from(TableA.class); root.join(TableA_.columnA).join(TableB_.columnB); root.join(TableA_.columnC); But it's wrong, it will cause 2 table_a.

13. New2Hibernate:How would look like these tables in Hibernate?    forum.hibernate.org

@Entity @Table(name = "AUTHORS", schema = "LIBRARY") public class Author{ @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "Author_ID") private int authorId; ...

14. 'Like merge operation' in read only mode    forum.hibernate.org

My apologizes for my English. I have a web application where domain objects are passed to presentation layer as detached object. The entity A has many eager loaded relations. When an user want to update datas, an instance of A is saved to http session. The user send updates by several forms. When he decides to commit updates, session.saveOrUpdate is called ...

15. OrderBy with Like clause does not work    forum.hibernate.org

16. How can i execute query like "SELECT 1=1"    forum.hibernate.org





17. Is it possible to saveorupdate/merge like this?    forum.hibernate.org

Hi every, Let say the entity is already in DB and in the code I created a new instance with only some of the fields set (including the identifier). Is it possible to direct hiberate to update or merge only non-null fields to the persistent object? Since some fields are not set in the newly created object, they are set to ...

18. "Like" query appears to produce invalid sql    forum.hibernate.org

HQL: select obj from obj in class com.mvsc.czee.business.codes.jurisdiction.Country where (upper( obj.description) like ? produces: select obj.country_id as country_id, obj.country_cd as country_cd, obj.description_txt as descript3_ from RM_COUNTRY obj where ((upper(obj.description_txt)like ? ) I think the "like" needs a space in front, or it gives me a sql syntax error: SQL0104N An unexpected token "END-OF-STATEMENT" was found following "ription_txt)like ? ) I've looked ...

19. Does Hibernate have Column Conversion like OJB?    forum.hibernate.org

20. find method with LIKE    forum.hibernate.org

21. Is it supposed to work like this?    forum.hibernate.org

I'm using Hibernate 2.1.1. As you can see below, mpReqItems is a "set" of MpRequisicaoSq044. So with the registers shown below the returned list must have one object of MpRequisicaoSq044 and two in it's mpReqItems "set". But that's not happening! It's returning two objects of MpRequisicaoSq044 each one with two in it's mpReqItems "set". Is my method code correct? Please help. ...

22. Escaping '%' in like clauses    forum.hibernate.org

Using Hibernate 2.1.2 against Oracle 9. It's a generic problem so I haven't included mappings yet... I want to construct a like clause in OQL to retrieve rows where the value in a field starts with the percent character. In JDBC, I would write this: select * from table_name where field_name like '&%%' {escape '&'} So I tried this in OQL: ...

23. how to execute SQL queries like following    forum.hibernate.org

gita wrote: Hi, How to execute queries like select sequence.nextval from dual into hibernate? Thanks gita I don't know if it is correct way, but in Java code I use net.sf.hibernate.id.SequenceGenerator: Code: /* SequenceGenerator is not serializable, let it be transient with lazy initialization */ transient private SequenceGenerator codeNumberSeqGenerator = null; private ...

24. Using an SQL "LIKE" Command    forum.hibernate.org

25. Selecting from a non-persister source (like dual)    forum.hibernate.org

Hi, First, some info about my environment: Hibernate version: 2.1.4 Database: Oracle 9.2i I'm using Oracle, so the following question is a bit oracle tinted, but should apply to other databases as well, only with some slight syntax differences. 1) I'm trying to execute a statement in hql. The sql equivalent would be "SELECT sysdate FROM dual". I'm having a hard ...

26. I'd like to contribute    forum.hibernate.org

Hi There! I gathered a team of interested people to translate the Hibernate reference manual to our native language (portuguese) in other to understand it better and help we consolidate all the knowledge we accumulated during the past year of hibernate use. Since we're definitely going to do it, perhaps we should use a way that the Hibernate Team could use ...

27. Hibernate 2 working on WebLogic 8.1 like a service (MBean).    forum.hibernate.org

Hi my name is Julio Helden and i am a brazilian guy. I would like to configure the hibernate like a service in Weblogic. In JBoss, i create a file named JBoss-service.xml and i put the following text in it: jboss.jca:service=RARDeployer jboss.jca:service=LocalTxCM,name=BCV_BRASIL_DS java:/hibernate/HibernateFactory_BR br/com/netservicos/core/bean/rh/PessoaBean.hbm.xml ...

28. Parametric like query    forum.hibernate.org

Hi, I'm a new user of hibernate and I have to make a simple query but I encounter a problem. I want to find documents with title that contains a string passed as a parameter. This is my query.... s.createQuery("from Document d where d.title like %:searchInTitle%") .setString("searchTitle",title) .list(); Hibernate return me this error: Parameter title does not exist as a named ...

29. Parametrize like don't work    forum.hibernate.org

Session session = AS400Session.currentSession(); Query sql = null; if(criteria.equals("CODICE")) sql=session.createQuery("Select ay.matema,ay.de30ma, from MaterialiVO as ay where ay.clmama=? and ay.matema like '?' and ay.strema='' "); else sql=session.createQuery("Select ...

30. Is there a way to mimic SQL LIKE in WHERE clause?    forum.hibernate.org

I'm not sure if this is a feature of "generic" SQL or not, but Microsoft's SQL Server allows criteria in a WHERE clause to be specified using the keywork LIKE and wildcards. Is there a way to do this with HQL? For example, with Transact-SQL, I could write: Code: SELECT * FROM PEOPLE WHERE FIRST_NAME LIKE 'J%' which would retrieve a ...

31. Hibernate LIKE    forum.hibernate.org

32. count() not working like it should    forum.hibernate.org

I'm reading through chap. 7 of Hibernate In Action and simply trying to count a field exactly like 7.4.2 describes, only it's not working correclty. Here's my method: Code: public Integer getCaseTotal(Order order, Date beginDate, Date endDate) { Session s = HibernateUtil.getCurrentSession(); ...

33. hql like % not performant enough    forum.hibernate.org

in my company we have table of 10, 100 thousands and even millions of records the environment is Oracle 10/Hibernate 3.1/Spring 1.2/JSF something if I use setString("studiejaarCode", studiejaarCode) instead of setString("studiejaarCode", studiejaarCode +"%") I do not get results at all any ways this method is very slow low perfomance ///////////////////////////////////////// final String sql = "select opleidingsonderdeel " + "from Opleidingsonderdeel opleidingsonderdeel, ...

34. Newbie: Many-to-Many HQL SELECT with LIKE on Collection    forum.hibernate.org

Hi, a simple newbie question for you :-). I have the following mapping. ------- A_SEQ ----------

35. like and in    forum.hibernate.org

36. Quotations in LIKE clause    forum.hibernate.org

37. How to make a SQL like this work?    forum.hibernate.org

Hibernate does not support subqueries in the from clause. Your SQL will produce a two column result set, in which the first column is the given parameter (always the same), and the second column is the column "table2.attr2". Why not forget the parameter, seeing as it'll always be the same, and just issue the SQL "select attr2 from table2"? That's so ...

38. Undoing a setProjection(). Should it be like this?    forum.hibernate.org

I am using the fancy new projection to get a count of rows, and then I want to re-run the same criteria as a list. This is just a simple pager. It generally goes like this : Code: Criteria crit = getSession().createCriteria(getPersistentClass()); .. add critiera objects crit.setProjection(Projections.rowCount()); return (Integer) crit.uniqueResult(); This leaves the critiera in a permanant 'projection' state, which I ...

39. Non-portable HQL with LIKE clause    forum.hibernate.org

I want to escape characters used in a LIKE clause of my HQL query with a backslash but I have a problem. MS SQL Server requires ESCAPE '\' but MySQL does not understand ESCAPE. Both JDBC drivers accept { escape '\' }, but it looks like hibernate does not use jdbc escaping for the LIKE clause. So I cannot write portable ...

41. *: in like clause causes HQL to fail    forum.hibernate.org

42. sql-query using like    forum.hibernate.org

Ia m using hibernate 3.1 and was wondering how to use a like statement in a sql-query when loading a collection. I have the key set up but I don't want it to have to match exactly. Please let me know if I am not clear. Thanks. ...

43. Using reserved words as column names (like length, year)    forum.hibernate.org

Hello, I am using the latest version of Hibernate with a Firebird SQL database. I am using the EJB3-Annotations style of coding. I have got a class "Article" that has a field "length". It looks like that: Code: @Entity @Table(name = "Articles") public class Article implements Serializable { private static final long serialVersionUID = 2511213307378988331L; ...

44. how do you like it?    forum.hibernate.org

45. SQL 'like' stm with underscore and escape '\'    forum.hibernate.org

Hi I use this query on oracle: select * from orgunit WHERE name LIKE '234\_\_\_' escape '\' I use backslash before every underscore in order to get exactly the name with underscore, I don't want to get every name that starts with"234", but I get more lines than I should: 234523_dddcopy_copy_copy 234___t_c_ 234__t_c_ It seems that escape '\' is ignored. How ...

46. select name,surname where surname like name||'%'    forum.hibernate.org

47. Criteria does not like classes    forum.hibernate.org

48. Shouldn't the enhanced TableGenerator behave like ...    forum.hibernate.org

@Id @GeneratedValue(generator="hibseq") @GenericGenerator(name="hibseq", strategy="org.hibernate.id.enhanced.TableGenerator", parameters = { @Parameter(name="initial_value", value = "1000"), @Parameter(name="table_name", value = "hibernate_sequences") } ) ...

49. Criteria in like    forum.hibernate.org

50. Criteria in like    forum.hibernate.org

51. Criteria in like    forum.hibernate.org

The MatchMode class has four properties that allow you to set the fuzzy matching facilities for an Example instance. The default is EXACT, while ANYWHERE is the most generous. END and START are bookend properties that only allow matches at the front or at the end of a given property. static MatchMode ANYWHERE Match the pattern anywhere in the string static ...

52. I'd like to contribute    forum.hibernate.org

Hi I believe many developers in Persian(Farsi) language countries are interested in Hibernate and are learning and using it. I have no idea if there is a Persian version of the documentation or even if it is of your translation plan. Any way, I am interested in contribution in translating Hibernate documentation to Persian. Please guide me. Thank you B.

54. Criteria and many to many query + like or in clause    forum.hibernate.org

The problem with this solution is I have to do it with affaire.requerants.nom affaire.requerants.prenom affaire.requerants.dateNaissance andd all the fields of other relations this is definitly not possible to subquery temporary subset of already retrieved elements list ? by using subquery or detached criteria ? the getRequerantsArray() already filter all data related to a specifc relation

55. 'like' selection from collection    forum.hibernate.org

Hi, I have an object which contains a List of Strings as a member. (A customer has several maildomains, see mapping below). I would now like to be able to search for a customer who has a certain maildomain. I was able to do this, with the following code: Query query = session.createQuery("from Customer c where :mailDomain in elements(c.mailDomains)"); query.setString("mailDomain", maildomain); ...

56. Need help to do something like Duplicate Killer    forum.hibernate.org

Hi All, I am using Hibernate to develop a contact application. I now need to add the support to detect duplicate contacts on the basis of Name, Email etc. I would like to know what could be the best implementation strategy for this problem? Should I make use of stored procedures or will APIs like Hibernate Search can help here? Any ...

57. HQL like clause    forum.hibernate.org

public List getAllOrderCreated(Intranet intranet, String alpha, int start, int max){ if(intranet==null){ return this.getSession().createQuery("from User where intranet is null and lastName like ?% order by createdAt desc").setParameter(0, alpha).setMaxResults(max).setFirstResult((start-1)*50).list(); } else{ ...