integer « Query « JPA Q&A





1. Hibernate cirteria, integer and like    stackoverflow.com

I'm migrating some of my hql-statements to Criterias now I'm figuring one problem: The entity property is type Integer but I need a like with wildcards search, so in hql I do

session.createQuery("from ...

2. Does the JPQL avg aggregate function work with Integers?    stackoverflow.com

I have a JPA 2 Entity named Surgery. It has a member named transfusionUnits that is an Integer. There are two entries in the database. Executing this JPQL statement:

Select s.transfusionUnits ...

3. How can we order a column as int using hibernate criteria API?    stackoverflow.com

Hi I want to fetch the data form data base using hibernate Criteria API. That data should be ordered by some column as number. This column is defined as varchar in DB. But ...

4. Postgre SQL LIKE for Integer    stackoverflow.com

I've some problem in my project, we use PostgreSQL and Hibernate as ORM. I want to perform search in my table for any column type (INTEGER, STRING, TEXT). Where are some problem with ...

5. JPA Like Operator with Integer    stackoverflow.com

Can someone tell me, why this is not working:

criteria.add(cb.like((myentity.<Integer>get("integerid")).as(String.class), "2%"))
I get the following error:
The object [2%], of class [class java.lang.String], from mapping [org.eclipse.persistence.mappings.DirectToFieldMapping[integerid-->MYENTITY.INTEGERID]] with descriptor [RelationalDescriptor(org.example.model.MyEntity --> [DatabaseTable(MYENTITY)])], could not be ...

7. Problem with getSingleResult() and setMaxResults(int)    forum.hibernate.org

Hello, I'm new to Hibernate, so I beg your pardon in the first place for asking questions that might seem simple or clear. We're running Hibernate 3.4.0 in a standalone application, on a MySQL 5 database (driver: mysql-connector-java-5.1.6). Whenever I use query.getSingleResult() or query.setMaxResults(1) and query.getResultList() Hibernate produces invalid SQL like select top ? loginsetti0_.setting_id as setting1_4_ from login_setting loginsetti0_ inner ...

8. Criteria, integer and like    forum.hibernate.org

java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer at org.hibernate.type.IntegerType.set(IntegerType.java:64) at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:154) at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:136) at org.hibernate.loader.Loader.bindPositionalParameters(Loader.java:1728) at org.hibernate.loader.Loader.bindParameterValues(Loader.java:1699) ...

9. Projection count returning Integer instead of Long    forum.hibernate.org

Hi, I'm trying to return the number of rows matching certain criterias on a very large table. The projections.count("id") works nice, but it returns an Integer. The table has much more rows than the max integer value. In this situation, what is a possible alternative using hibernate to get the long value? Also, why does it return an Integer? Wouldn't be ...





10. the syntax select new MyObject(Integer a).... may be a Bug    forum.hibernate.org

Newbie Joined: Mon Dec 01, 2003 9:16 am Posts: 6 Location: Paris Hello, I have a problem concerning HQL querys. I can't get Integer or Short Object using the syntax "select new ......" the code is this one: ********************************************************* public List getListeParametreFCP() throws RunTimeApplicationException { Session session = newSession("fcp"); List listeTestHibernate = null; Logger log = Logger.getLogger(this.getClass()); try { StringBuffer requete ...

11. The "class" query property is an Integer?    forum.hibernate.org

I'm trying to use the special "class" property in my Criteria query, and it looks like it is decoding the class to an Integer instead of the class name String. I'm using table per subclass inheritance mapping, so I don't have a discriminator column for it to select against. Is there a way to use the "class" property in a query ...

12. comparing a string with an int in hql queries?    forum.hibernate.org

Hi all, I have a values (01,02,03,04,05 etc) stored in the db as strings. i am forced to store them as strings because of a few constraints in the framework I am using. is there a way to compare these values which are stored as strings in the db to integers in hql queries? like... select from abc where '01' > ...

14. Projection row count returns integer    forum.hibernate.org

15. Aggregate function in 3.2 - Criteria - Still Returns Integer    forum.hibernate.org

Example exampleLightbox = Example.create(lightbox).ignoreCase(); Integer count = (Integer) session.createCriteria(ELightbox.class) .setProjection(Projections.rowCount()).add(exampleLightbox) .add( Restrictions.eq("customerId", lightbox ...

16. count(*) result Long/Integer    forum.hibernate.org

Hibernate version: hibernate-3.2.5 We are developing a big applications (about 1000 tables in the db) with Hibernate and we are using Hibernate 3.1.0 I've just download and install Hibernate 3.2.5 GA and I've seen that the class of the result of a query like "SELECT COUNT(*) FROM ..." is changed. Version 3.1.0 was Integer Version 3.2.5 is Long Is there a ...





17. like with int columns    forum.hibernate.org

How can I make a query with like in hibernate for a integer column in the database. I tried but it gives me a class cast exception (java.lang.String cannot be cast to java.lang.Integer) the objective is: when I search for the number 45 the result is: 45 450 1245 124598 How can I do it? can I do it with the ...

18. criteria query + order by clause + int    forum.hibernate.org

19. varchar2 needs sorted as integer    forum.hibernate.org

I am trying to create a query HQL or Criteria that will return the result set sorted numerically, however, the numbers I need to sort, are in an varchar2 field. I looked at using a @Transient field, but could not get that to work. I also tried to use @Formula, but that would not work. Any help would be appreciated.