type « Query « JPA Q&A





1. Use type of object in HQL where clause    stackoverflow.com

In my domain model I have an abstract class CommunicationChannelSpecification, which has child classes like FTPChannelSpecification, EMailChannelSpecification and WebserviceChannelSpecification. Now I want to create an HQL query which contains a where ...

2. Sorting on Column in Type Table with ColdFusion ORM    stackoverflow.com

I have three tables, with the following structure: http://dl.dropbox.com/u/2586403/ORMIssues/TableLayout.png The three objects I'm dealing with are here: http://dl.dropbox.com/u/2586403/ORMIssues/Objects.zip I need to be able to get a PartObject, and then ...

3. Can I specify the result object type for an HQL query?    stackoverflow.com

I have an entity in a hibernate instance called keywords. It stores a list of words and the number of times each word occurs. Words are not unique. I want to ...

4. How to deal with Object type returned by JPQL query?    stackoverflow.com

I can do this easily with JPQL that only returns data from one table.

SELECT m1 FROM MasatosanTest m1
That means one data type is returned. So I can just store the query ...

5. Using Hibernate to find the specific database type for a given Java type    stackoverflow.com

Is there a class that I could use in Hibernate so that I could pass in a class and it would return the appropriate database type name? For example,

String type = HibernateTypeGod.getTypeName(String.class);
Hibernate ...

6. Fluent NHibernate HQL Assigning multiple class types to multiple table select query    stackoverflow.com

I know how to assign class type to the data retrieved from single table like this: HQL query:

select s from Employee e join e.Store s where s.Id = 1
Code:
var stores = session.CreateQuery(hql).List<Store>();

foreach ...

7. Set selection of typesafe JPA 2 query with joins    stackoverflow.com

I have simple query with two joins:

SELECT p.id, BU.ID, BU.TEXTLANG  as Title FROM PROJEKT P
  JOIN Text BT ON BT.ID = P.TITEL_ID
  JOIN Uebersetzung BU ON ...

8. type-safe JPA2 -how to handle select with 'not-in' clause    stackoverflow.com

hI am converting my JPQLs to type-safe queries and am not sure how to handle queries that have 'not in' clause. select p from Person p a WHERE p.address.id = :id ...

9. Create typed query through the session factory in JPA/Hibernate    stackoverflow.com

I generally want to do something like this:

CriteriaBuilder qb = em.getCriteriaBuilder();
CriteriaQuery<Person> c = qb.createQuery(Person.class);
But through the session factory rather than the entity manager. Something like:
final TypedQuery<MyType> query = getSessionFactory().getCurrentSession().createTypedQuery(MyType.class, "query");
It should be ...





10. Possibilities and limitations of executing a criteria query on a java.net.URL type object    stackoverflow.com

I have a database table where I store URLs (http://google.com for example). The entity corresponding to the table has a URL type field, so I create a criteria query like the ...

11. HQL Query return type    coderanch.com

12. Hibernate query using a custom user type    coderanch.com

All, I'm trying to create a Hibernate query. Here's my named query that works so far that I define in my mapping file: from common.datastructures.alarm.AlarmInfo as alarmInfo where alarmInfo.deviceId = :mrgreen: eviceId AND alarmInfo.clearedDate > :afterDate AND alarmInfo.clearedDate < :beforeDate order by alarmInfo.clearedDate What I'm trying to add is the following: * there's an object in the AlarmInfo ...

15. Using column of type CLOB in where clause throws ORA-00932    forum.hibernate.org

Hi all, I have an application where some of the hibernate entities have string properties larger than 4000 characters. Those properties are mapped with type="text". The hibernate schema generation mechanism craetes columns of type CLOB for those entity properties, which is perfect. The problem is, when I try to execute a HQL query where the CLOB column is in the where ...

16. JPA - Named Queries - Get parameter types    forum.hibernate.org





17. HQL query returning improper type    forum.hibernate.org

I am writing a simple query in hibernate. It is not returning the proper information. So my code looks like this: Code: List skulist = session.createSQLQuery("select sku from (select ppbd.prft_sku as sku, avg(coalesce(ppbd.prft_net_margin_percent)) as net_margin_avg from analytics.projection_by_day ppbd where ppbd.prft_sku like :sku_like group by ppbd.prft_sku) tbl1 where tbl1.net_margin_avg >= :margin_percent") ...

18. Sorting a DB table column of 'Date' type based on Date only    forum.hibernate.org

Hi, In hibernate, I am trying to get a resultset after performing a sort on a table column in DB. The table column is of Date data type and contains entries with date and time. Here, I am using criteria.addOrder(Order.desc("dateTime")); where dateTime is a Date data type. However, my sort does not work as intended as the sorting is done based ...

19. Object type problem with Hiberante Criteria Query    forum.hibernate.org

Criteria cri = this.session.createCriteria( Book.class ) .add( eq( "type" , "food" ) ) .addOrder( Order.asc( "serNo" ) ); cri.setFetchMode( "authorInfo" , FetchMode.JOIN ); ...

20. Automatically Inferring Types With Native Queries    forum.hibernate.org

Hi, I'm running native queries via createSQLQuery(). When the query is returned, all objects in the list are of Strings. I've not set any Scalar values and don't want to. I was hoping Hibernate would infer the types from the ResultSet but this doesn't seem to be the case. Is there anyway I obtain get this behaviour? Thanks, Sam

21. Type Hierarchies: Queries in JPQL vs. Criteria API    forum.hibernate.org

Hi all, in my projects data model some Type Hierarchies are mapped using a Descriminator Column on an abstract base Type. Sometimes Types have references to abstract base Types but I have to do queries on specialized Attributes. Currently Im using Sub-Queries e.g. Code: @Entity @DiscriminatorColumn(length = 2) class Base{ String value; ... } @Entity @DiscriminatorValue("A") class ...

22. How to query a value typed object    forum.hibernate.org

I am trying to learn hibernate and I came across this little problem en route. Any help will be appreciated. I have created a entity and a value typed object. My entity is of type Person which is mapped to value object of Address. The mapping is given below: Code: 1. ...

23. Could not resolve property type in Query    forum.hibernate.org

Hi, I'm trying to execute the following query with hibernate : from org.smartcomps.twister.engine.priv.core.dynamic.impl.ProcessInstanceImpl as instance join fetch instance.properties as props where props.name in (:propNames) and props.value in (:propValues) I'm getting this exception : net.sf.hibernate.QueryException: could not resolve property type: name [from org.smartcomps.twister.engine.priv.core.dynamic.impl.ProcessInstanceImpl as instance join fetch instance.properties as props where props.name in (:propNames0_, :propNames1_) and props.value in (:propValues0_, :propValues1_)] Here is ...

24. Scalar Queries do not seem to work with Custom Type    forum.hibernate.org

I am using a UserType to map Clob to String , the code is similar to the example provided in http://hibernate.bluemars.net/76.html . The nullsafeget method is like this: public Object nullSafeGet(ResultSet rs, String[] names, Object owner) throws HibernateException, SQLException { Clob clob = rs.getClob(names[0]); return clob.getSubString(1, (int) clob.length()); } The mapping class is : public class Dummy { String id; String ...

25. Problem resolving property type in where clause    forum.hibernate.org

I have a column in MySQL which is a smallint unsigned. I am using a short type for this in the hbm.xml file but Hibernate is not liking this in a where clause. What is wrong with this type and how can I track it down? Thanks, SZ net.sf.hibernate.QueryException: could not resolve property type: forumid [select thread.threadid, thread.forumid, thread.title, thread.postusername, thread.replycount, ...

26. using custom value types in HQL query    forum.hibernate.org

I've created my own value type to extract some strange encoded boolean values and send them to my java app in a well formed Boolean object. It works, but I don't understand how to use these types in a query : for example : my custom value type is "myownpackage.MyBoolean" s.iterate( "from XXX as p where p.strangevalue = ?", new Boolean(true),myownpackage.MyBoolean.????); ...

27. Which collection type for sorted collection?    forum.hibernate.org

A colleague and I are going round and round on trying to figure out which Hibernate collection type will best fit our need for an ordered collection that does NOT have a good candidate column for an index. We have several scenarios where the collections in question use either dates or strings or large integer numbers (abstract keys) to determine their ...

28. Types collection query error    forum.hibernate.org

Newbie Joined: Wed Apr 21, 2004 12:03 pm Posts: 4 Folks, We are getting an error when we query using hibernate in a particular situation. We have a many-to-many relationship between a persistent class and a hibernate persistent enum. The queries work fine if the constraints are just based on values from the persistent class. The returned objects correctly return the ...

29. Many to Many Types collection query error    forum.hibernate.org

30. could not resolve property type userId in the query excetion    forum.hibernate.org

hi! i got one exception like that ******************************************** net.sf.hibernate.QueryException: could not resolve property type: userId [SELECT groupHBM FROM com.liferay.portal.ejb.UserHBM userHBM JOIN userHBM.groups AS groupHBM WHERE userHBM.userId = ? AND userHBM.portalId = ? ORDER BY name ASC] Tables used as following user_ fields ****** 1)userId 2)portalId 3)password 4)firstname group_ fields ***** 1) groupId 2) portalId users_groups(Mapping table for user and group) fields ...

32. select cat,count(*) from cat groupt by cat.type --> resul    forum.hibernate.org

dear all... how to get the cat as Cat and the count of cats by giving the query as "select cat,count(*) from cat groupt by cat.type" to the following function? i am getting my function works fine. but i couldnt get the results wht i desired thru java codings...rather i dunno...! am i right in defining the function which returns Collection ...

33. Sort collection by class type    forum.hibernate.org

Hello all, Let me explain the situation: We have an interface or abstract super class X with several implementors A, B, C and so on... When I get all Object of type X like this: Query q = session.createQuery("from X x "); I want to sort them by their classes. For example: objects of type C before A before B C ...

35. Re: Urgent Please Help regarding Query return type    forum.hibernate.org

I am running the following query, I get a list size of 160. How do I cast the objects returned to date type, I get an exception Regards, Vinaypal Hibernate version:2.1.8 [b]Mapping documents: Named Query select eligible_from,eligible_to from common.vehicle_eligible ve, common.vehicle_year vy where vy.numeric_year = ve.model_year and ve.program_code = :programCode Code between sessionFactory.openSession() and session.close():[ Session s = ...

36. how works method find(query,objet[],Type[])?    forum.hibernate.org

37. HQL query returning unexpected type    forum.hibernate.org

Author Message Scott Post subject: HQL query returning unexpected type Posted: Fri Jul 08, 2005 11:37 pm Beginner Joined: Sat May 01, 2004 2:44 am Posts: 32 Location: Brisbane, Australia Hi all, I am having a strange problem with a HQL query I am running. My object model looks (simplified) like this: Code: CustomerQuoteRate: Customer customer; ...

38. Select into type safe object: Ordering    forum.hibernate.org

My question was; How is it possible to order by a type safe object? If you need mapping information, I can supply that however, I don't feel it is relevant. I'm not asking someone to solve my problem, I'm asking if and how it is possible to order/access a type safe object. The exception I'm experiencing is due to me not ...

39. Using TEXT column type in a where clause?    forum.hibernate.org

I'm writing an application that needs to be run in Oracle and SQL Server and needs to support AL16UTF16 and UTF-8 character sets respectively. I need a column that could be up to 4000 characters or greater, so I was going to map the text type to a NCLOB and NTEXT (oracle/Sql Server) column. But i was then told by people ...

40. selecting into type safe object    forum.hibernate.org

Regular Joined: Thu Sep 23, 2004 11:53 am Posts: 83 Need help with Hibernate? Read this first: http://www.hibernate.org/ForumMailingli ... AskForHelp Hibernate version: 3.1 Mapping documents: Code: