select 1 « Query « JPA Q&A





1. How to select from HQL    stackoverflow.com

I'm new to HQL and have a SQL expression I need converted but am unable to select the SQL statement is:

select SenseDate as Time,SenseValue as Value
from UserData
where NetworkID = '23'
and IODeviceID ...

2. Hibernate advanced select    stackoverflow.com

We want to get a row from a table using Hibernate a la:

  1. select max(id) from mytable where date = <date>
  2. Then select * from mytable where id = <max_id>
We are currently ...

3. Hibernate Criteria - Exclude groupProperty from select    stackoverflow.com

I would like to use a hibernate criteria object as a subquery on a second criteria, like this:

    DetachedCriteria latestStatusSubquery = DetachedCriteria.forClass(BatchStatus.class);
    latestStatusSubquery.setProjection(Projections.projectionList()
   ...

4. Select using hibernate    stackoverflow.com

I saw few examples over internet of Hibernate using transaction.commit() for select statements. Below is the example code.

public static List<?> list(Class<?> className,int start,int limit,SearchFilter[] searchFilter){
    Session session = ...

5. Hibernate is performing unwanted SELECTs on call to saveOrUpdate    stackoverflow.com

Let's say I have a House entity which maps to many Person entities. I then load an existing House which has 20 occupants.

beginTransaction();
House house = houseDao.find(1L);
commitTransaction();
Later in the ...

6. Hibernate Criteria limit select    stackoverflow.com

So, I have a rather complex query I am trying to make using the Hibernate Criteria API. I have the following entity classes:

Code
Gift
GiftVendor
...

7. High Level Java Client selection for Apache Cassandra    stackoverflow.com

I got interested in geospatial applications last time and understood their need for flexible data storage solutions regarding partition tolerance. As I found a job advertisement as java developer which includes ...

8. Selecting simalar-looking items with HQL    stackoverflow.com

I have a form that makes widgets, if a user is trying to make a widget that's similar to one already in the database I'd like to let them know by ...

9. JPA/Criteria - Select (or multiselect) on SetAttribute    stackoverflow.com

I am getting really frustrated trying to use JPA criterias (I am using Hibernate implementation).. I want to make a query where the select is on a Set of objects, but ...





10. Selection of frame work for a Java Application    stackoverflow.com

I am going to work on an complex application.Application is about to create lakhs of form dynamically, on those form rules can be apply dynamically and transactions of that forms. For this ...

11. JPA multiple select query    stackoverflow.com

I have a query like this, how can I get my entity type from the list? It is returning like object,but when I cast to my Entity it does not cast. my ...

12. Any ways to have single select query instead of multiple select queries in Hibernate?    stackoverflow.com

I am using Spring + Hibernate(HQL).
I have a requirement where I need to fire select query multiple times as parameters are different each time.
For Example
SELECT * FROM MY_TABLE ...

13. Hibernate Query selection    stackoverflow.com

In a database consider that I have a table with 4000 rows. I am using JTable to list them in front end. During page load, I need to display only First ...

15. Inner Select in HQL    coderanch.com

I want to represent the following SQL query in HQL. select time_dim_id, (select count(*) from ut_users user2 where user2.user_created_time_dim_id <= time.time_dim_id ) as TotalUsers from ut_users user1, ut_time_dim time where time.time_dim_id = user1.user_created_time_dim_id group by time_dim_id order by time_dim_id Is this possible? I get the following error when I run the query: Exception: net.sf.hibernate.QueryException: aggregate function expected before ( in SELECT ...

16. A simple Select HQL not working    coderanch.com





17. Regarding JPA Select Query    coderanch.com

18. Want to avoid multiple SELECT when using "new" in HQL    coderanch.com

Consider a simple class heirarchy @Entity @Table(name = "ABSTRACTEMPLOYEE") @Inheritance(strategy=InheritanceType.SINGLE_TABLE) public abstract class AbstractEmployee { @Id @Column(name = "ID") @GeneratedValue(strategy = GenerationType.AUTO) private long id; @Column(name = "NAME") private String name; @Column(name = "ADDRESS") private String address; @ManyToOne(cascade = { CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REFRESH }) private Car car; . . . } This query gets around the N+1 select issue for the ...

19. Cant select VIEW via dblink with JPA    coderanch.com

Hi all, Using jboss5.1.x, EJB3.0 ,JPA3 I am trying to do 'select' query from view which is connected via dblink to another database. this is the view which is created in the oracle database: CREATE OR REPLACE VIEW INF_METER_ECMS_VW (ID, METER_NUM, MODEM_ID, MODEM_TYPE, PORT) AS select INFMETERID, INFMETERNUM, INFMODEMIP, INFMODEMTYPE, INFMODEMPORT From INF_METER_ECMS_VW@TO_VANTIVE8 / if I run the select in the ...

20. best way to implement browsing with counts per selection?    forum.hibernate.org

Hi, I'm exploring the best to do the following: There is a view where the user can select various options, and each option builds a search query. The options are in different sections, like location, type, category, etc. The screen will show all the options for each section. Next to each option, I need to put the number of results that ...

21. How to avoid multiple SELECT when using "new" in HQL    forum.hibernate.org

Beginner Joined: Thu May 28, 2009 10:25 am Posts: 21 Consider a simple class heirarchy Code: @Entity @Table(name = "ABSTRACTEMPLOYEE") @Inheritance(strategy=InheritanceType.SINGLE_TABLE) public abstract class AbstractEmployee { @Id @Column(name = "ID") @GeneratedValue(strategy = GenerationType.AUTO) private long id; @Column(name = "NAME") private String name; ...

22. promlem with non-select Queries of HQl    forum.hibernate.org

hi, i m getting problem with delete Query Of HQL code: Transaction tx=ses.beginTransaction(); Query q1=ses.createQuery("delete from EmpBean as where eb.no>=? and eb.no<=:p1"); q1.setInteger(0,100); q1.setInteger("p1",200); int rowcount=q1.executeUpdate(); System.out.println(rowcount); tx.commit(); Compilation Error: can find symbol executeUpdate() but i imported org.hibernate.cfg and org.hibernate packages and also i added jar files to the classpath.... Can you tell how to solve this error?

23. Inner select with criteria    forum.hibernate.org

24. Complicated Select    forum.hibernate.org

I have 2 objects, Book and BookEdition. A Book can have many BookEdition (One to Many). I want to select a list of bookEditions with thier corresponding book, with that bookEdition being the one with the highest publication date for that particular book. I want to limit it to say, the top 10 most recent books editions, but do not want ...

25. Select a song with the tags Blackmetall AND Didgeridoo    forum.hibernate.org

Ok so easy question probably, but I had an accident with the microwave and now my brain is all messed up. A Song has Tags on it. class Song { List tags; } and I want to be able to select a song that has 1 or more specified tags. i.e. only show the songs that have the tag Blackmetall, or ...

26. (Sub)Select possible for JoinTables ?    forum.hibernate.org

Hello, I have added a JoinTable for a one-to-many association that is defined with Fetch=subselect and with this addition the performance gets lost. It's because hibernate now generates a JOIN clause for the join-table. -> Is it possible to declare the JoinTable itself as fetch = SUBSELECT/SELECT , so that the needed id gets determined in 2 selects instead of in ...

27. query must begin with SELECT or FROM:    forum.hibernate.org

28. 16 sec for simple Hibernate select...    forum.hibernate.org

public AjaxFrontController{ RecipeManager manager = new RecipeManager(); @RequestMapping("/addCategory.do") public void addCategory(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { String parentId = request.getParameter("parentId"); String newCategory = request.getParameter("newCategory"); Category childCat = new Category(newCategory, 2); long ...

29. N+1 Selection    forum.hibernate.org

@Entity class Survey { @OneToOne(cascade = CascadeType.ALL, optional = false) private SurveyPayload payload; } @Entity @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS) abstract class SurveyPayload { } @Entity class ShortPayload extends SurveyPayload { String question1; } @Entity class LongPayload extends SurveyPayload { String question1; String question2; String question3; }

30. Hibernate hanging on SELECT query    forum.hibernate.org

Newbie Joined: Fri May 28, 2010 6:06 am Posts: 2 My app runs for quite some time, but after a certain number of queries, it hangs. I wonder if this is to do with my session not closing properly but I've look at my code and configuration and can't see anything wrong: Code here:- Code: /** * */ package com.cmmgroup.daos; import ...

32. URGENT: Uni directional many-to-one does select    forum.hibernate.org

Hi, I Have an issue where my many-to-one association fires an extra select for every row on Many side of the association when it is unable to find a match on the one side of the assocation. For example in the data set i have a table with cardno which has an many to one association to the attendant card number. ...

33. SELECT NEW org.package.PersonInfo(p.personId = u.person.pId)    forum.hibernate.org

Hi everybody! I'm trying to use the "new" constructor as follows: SELECT NEW org.package.PersonInfo(p.personId, p.name, p.lastName, " + " (p.personId = u.person.personId))" + "FROM Person p, User u WHERE " + "p.personId = u.person.personId " + "ORDER BY p.lastName") I'm wondering if this construction with a boolean expresion "(p.personId = u.person.personId)" is feasible because it always returns false, even when I ...

34. select * wrapping sub select in HQL    forum.hibernate.org

Hi guys How can I use something like Code: select * from(...) on sub select in HQL query ? My motivation for it is that i need to use order by and limit the number (omitted at this point) of returned rows from inner select. While the sorted and reduced rows will be part of "in" expression of wrapping query In ...

35. Keyword as in select    forum.hibernate.org

36. strange selects in hibernate    forum.hibernate.org

Page 1 of 1 [ 2 posts ] Previous topic | Next topic Author Message marcelovvm Post subject: strange selects in hibernate Posted: Sat Sep 04, 2010 11:49 pm Newbie Joined: Sat Sep 04, 2010 11:35 pm Posts: 2 Location: Rio de Janeiro - Brasil Dear friends, I am developing my ...

38. Selecting sysdate    forum.hibernate.org

I'm running oracle 10 and hibernate. I'm trying to determine if there is a hibernate query that I can run to execute "select sysdate from dual". I googled and searched the forums and found some posts dating back to 2007 that indicate that I must do this in a native query. Is this still the case is there a fairly recent ...

39. How do I do a Select query in Hibernate    forum.hibernate.org

I am doing a simple login application, where the user needs to provide his username and password in order to sign in. I need to verify username and password using Hibernate. Now with JDBC i'd get a connection obj, get a statement obj get a result set obj execute the query viz (Select id from person where cname ='"+username+"' and passwd ...

40. select ... from ( select    forum.hibernate.org

41. Hibernate-Criteria executes multiple selects    forum.hibernate.org

Hello, I am using Criteria API for fetching data. Say we have simple Entity: @Table(name="A") public class A { @id @Column(name = "id") private long id; @Column(name="Description", nullable=false, length=20) private String description; } This is code for fetching data: Criteria criteria = session.createCriteria( A.class.getName()).setFirstResult(offset * maxResults).setMaxResults(maxResults); criteria.addOrder(Order.asc("id")); return criteria.list(); When i use this code i can see that one select is ...

42. HQL : Hierarchy select solution    forum.hibernate.org

As well known we can't use starts with / connect by in HQL. However I have to use HQL and not native therefore I came with a solution of : 1. fetching my hierarchy data into an id list. 2. Concatenating the id list into "IN" clause in my HQL query. It work fine obviously, until my id list became larger ...

43. repeated select    forum.hibernate.org

Hi all, I recently join a new application team developpers and noticed some strange behaviors about the persistence layer of their application. Is there any reason or any particular hibernate configuration that explains the more a simple (w\o any eargly fetched data) select query is repeatedly executed the more time is execution takes. Here is a example of HQL query : ...

44. Adding "with ur" to the end of any select statemen    forum.hibernate.org

Apparently "with ur" allows the DB2 database to select data without placing any locks on the database tables. I've been asked to add that to any select statement that I send to the database. We're accessing DB2 7.1 on an OS 390. I've looked through the dialect settings, and was unable to find a place to add that. Is this something ...

45. Q: Why not in one select?    forum.hibernate.org

Newbie Joined: Thu Oct 16, 2003 1:02 pm Posts: 1 Location: Poland What am I doing wrong that following query: Code: List list = session.find("select parent from Parent parent left outer join parent.children"); cause so many selects: Hibernate: select parent0_.bbb_id as bbb_id, parent0_.bbb_name as bbb_name from deploy.dbo.bbb parent0_ left outer join deploy.dbo.aaa children1_ on parent0_.bbb_id=children1_.aaa_bbb_id Hibernate: select aaa0_.aaa_id as aaa_id__, aaa0_.aaa_id ...

46. one-to-many in one select    forum.hibernate.org

Hello, Can I change the example below to make Hibernate load this objet in one sql statement? Thanks! Mappings:

49. SELECT Read only    forum.hibernate.org

Hye, We are using UDB DB2 v7 and we want use the FOR READ ONLY clause of DB2 in a SELECT query. This clause tells the database not to lock fetching rows. Example : SELECT person from friends FOR READ ONLY. How can we add this clause when we need it ? Thank's

50. Multiple Sub-Selects Can I even do this with Hibernate?    forum.hibernate.org

Hold on to something..this is pretty ugly. from ExternalIdEquipMap e select e.externalId, e.accountNo from (select replace(e.externalId,,' ', '') e.externalId, e.accountNo from (select translate(e.externalId,':-CcSsDd',' ') e.externalId, e.accountNo where e.externalIdType = 2 and e.inactiveDate is null and e.accountNo = :accoutNo) where e.externalId like ('800%') OR e.externalId like ('866%') OR e.externalId like ('877%') OR e.externalId like ('888%') ) where length(e.externalId) = 20) My dialect ...

51. select x as something    forum.hibernate.org

The problem I'm having is the case where you select individual fields from several joined tables. The result sets that are returned are not self describing, as in you have to know the order in which fields are specified and access them by an array index which will break should a new field be inserted into the table anywhere but the ...

52. Auditing Selects    forum.hibernate.org

We have a requirement that all database selects must be logged and cannot see any obvious method for achieving this. The onLoad() interceptor method appears to log object loads but not reads of individual columns from HQL queries. If anyone has successfully implemented a method of doing this perhaps by logging the sql itself or by some other method I would ...

53. the first select runs ok,but the second select can't run!    forum.hibernate.org

com.one2many.Author objAuthorRs = null; com.one2many.Author objAuthorERROR = null; String strQueryString = "select p from com.one2many.Author as p where p.AUTHORID like :ID"; net.sf.hibernate.Query objQuery = objSession.createQuery(strQueryString); objQuery.setString("ID","111"); //java.util.Iterator objIteratorRs = objQuery.iterate(); //while(objIteratorRs.hasNext()) //{ // objAuthorRs = (com.one2many.Author)objIteratorRs.next(); // System.out.println(objAuthorRs.getALIAS()); //} for(java.util.Iterator objIteratorRs = objQuery.iterate();objIteratorRs.hasNext();) { objAuthorRs =(com.one2many.Author)objIteratorRs.next(); //objAuthorRs =(com.one2many.Author)objQuery.list().get(0); System.out.println(objAuthorRs.getALIAS()); } //strQueryString = "select a.AUTHORID,a.ALIAS from com.one2many.Author AS a WHERE a.AUTHORID LIKE ...

54. select new Family(mother, mate, offspr)    forum.hibernate.org

Hello, I was unable to run the folowing sample, extracted from Hibernate's documentation (using v2.0.3) : " select new Family(mother, mate, offspr) from eg.DomesticCat as mother join mother.mate as mate left join mother.kittens as offspr assuming that the class Family has an appropriate constructor. " The point is what is the "appropriate constructor" for parameters that are "multi-valued" (like offspr in ...

55. queries with "select new" can't using in more tha    forum.hibernate.org

queries with "select new" now cacheable ------------------------ can't using in more than 2 tables???? ------------------------- Query query = ss.createQuery("select new SectionalFieldsClassName( a.x, b.y) from A a, B b"); =================== problem 1: when it be used in 1 table, i must wirte codes in A.hbm.xml so, i must write codes in B.hbm.xml????? if i do that , the problem is ...

56. queries with "select new" can't using in more than    forum.hibernate.org

queries with "select new" now cacheable ---------- it can't using in more than one table? ==================================== i want do : Query query = ss.createQuery("select new SectionalFields(a.x,b.y) from A a, B b"); ============================ problem 1: For using Class "SectionalFields", we must write codes "" in *.hbm.xml if i only do "select new SectionalField2(a.x) from A a", it has no problem. but ...

57. substring in select query    forum.hibernate.org

hi, i am trying to translate a ms sql select query into HQL. query is : select max( substring ( field ,1,5 )) as col1 from table1 max works ok with number fields. but i have to substring a String field to get a integer then increment it. i have searched the message board and faq. i am not not find ...

58. Many selects with simple one-to-one [1-to-1]    forum.hibernate.org

... (props)

60. Select ...    forum.hibernate.org

61. HQL - product and sum in select    forum.hibernate.org

Newbie Joined: Mon May 31, 2004 6:26 am Posts: 18 I wrote the following query: list = session.find("select SUM(postavka.kolicina*normativ.normativ), material.id " + "from IzdaniRacun racun " + "inner join racun.postavke postavka, " + "NormativIzdRac normativ " + "inner join normativ.material material " + "where postavka = normativ.postavkaIzdRac " + "group by material.id"); The generated SQL query is correct, but I get ...

62. select "foo", cat.name from cat    forum.hibernate.org

63. addition in select query    forum.hibernate.org

64. "select first" in HQL??    forum.hibernate.org

65. how to do sum(x*y) in select cllause?    forum.hibernate.org

Michael, Why are you so grumpy? To answer your question, I am still in shock that such a highly toughted persistance framework does not support something as basic as sum(obj.x*obj.y) in the select clause. In addition, the error message I get back "no appropriate constructor in class" does little to suggest that this operation is not supported. Regards, Joshua

66. PropertAccessException while selecting    forum.hibernate.org

Hi, I am new to Hibernate. I am selecting record from a Oracle table. The column is a NUMBER and has null value in the database. The java variable is declared as 'int'. Hibernate is giving me PropertyAccessException while setting this value. If the column value is '0' instead of null, it worked ok. There was a suggestion in this forum ...

67. Select new myBean(col1,col2,col_datetime)...    forum.hibernate.org

Hibernate version: 2.1.6 Full stack trace of any exception that occurs: net.sf.hibernate.PropertyNotFoundException: no appropriate constructor in class: myPackage.myBean at net.sf.hibernate.util.ReflectHelper.getConstructor(ReflectHelper.java:214) at net.sf.hibernate.hql.QueryTranslator.renderSQL(QueryTranslator.java:560) at net.sf.hibernate.hql.QueryTranslator.compile(QueryTranslator.java:155) at net.sf.hibernate.hql.QueryTranslator.compile(QueryTranslator.java:138) at net.sf.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:294) at net.sf.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:1562) at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1533) at net.sf.hibernate.impl.QueryImpl.list(QueryImpl.java:39) at system.TestDBAHibernate.(TestDBAHibernate.java:15) at system.CacheInit.(CacheInit.java:14) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:274) at java.lang.Class.newInstance0(Class.java:308) at java.lang.Class.newInstance(Class.java:261) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:987) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:862) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4013) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4357) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083) ...

69. my app freezes after repeting the same select    forum.hibernate.org

Hello I have a grid in my web application and after viewing a few pages correctly everything freezes. This is the only place in my application this happens. I use Spring, so I don't create manualy my sessions. I use something like this: query = getSession().createQuery(sqlQuery).setFirstResult(startWith). setMaxResults(maxResults); I use MySql and the grid displays only 10 rows at a time of ...

70. Why so much selects ?! What is better !?    forum.hibernate.org

Hi all! In a relationship one to many i just add one child to parent like Phonecall (child) to City(parent) Phonecall (child) to People(parent) Phonecall (child) to Employee(parent) and the Parent already exists, so it does SIX (6) selects before to insert in Phonecall,even i use lock. How could i tune this queries?! Thank you.

71. how to use select new in HQL    forum.hibernate.org

72. Expected in SELECT but no in    forum.hibernate.org

I'm trying to execute the following query: select avg(mark.score * rating.ratingQuality) as avg1, avg(rating.ratingQuality) as avg2 from Mark as mark join mark.rating as rating join mark.rating.product as product where product.id = ? and rating.approved = " + Rating.APPROVED + and rating.creationDate >= ? and rating.creationDate < ? group by mark.id I'm binding the following array: new Object[] {softwareId, startDate, endDate}. The ...

73. selects on a view    forum.hibernate.org

Hello, I'm having troubles with views. I would like to perform a select query on a view. In results, i get a list filled of null objects. The number of null object is the right number of object i should have. My key on the view is a composit one made of all the columns. Here is the java part Code: ...

74. select sysdate from dual    forum.hibernate.org

75. hibernate - limit and offset in select query    forum.hibernate.org

is there any way to use limit and offset features of mysql in hibernate queries? For exmple I have 100 rows in my results. I want to display the results page by page. How can I select rows starting from a particular index (for example from 10 to 20 instead of starting at the first record). The 'setMaxRows()' function can limit ...

76. one query but multiple selects!?    forum.hibernate.org

Author Message hibernatebenutzer Post subject: one query but multiple selects!? Posted: Thu Aug 11, 2005 8:04 am Newbie Joined: Thu Aug 11, 2005 7:43 am Posts: 5 hello i have following hibernate problem in an application, which i must support, but which i have not implemented: following query

77. QuerySyntaxError when using "as" in select stateme    forum.hibernate.org

I have the problem that I can not use "as" in a select statement of a query I use. As soon as I do not use "as" everything is fine. But in fact I need "as" because I want to have an "order by" statement for one of the attributes I am querying for. Any help is welcome. Regards Guido Hibernate ...

78. "Static select" and "Snapshot select" ar    forum.hibernate.org

Hello! I'm having a problem with different queries being generated for exatly the same mapping. The problem is inconsistent and updating the mapping file (just rewriting it so that the timestamp is updated) suddenly solves the problem, but then it comes back again. Redeploying with the same file doesn't help. This is a snippet from the initialisation of the mappings. Code: ...

79. second try: hibernate, firebird and "select from select    forum.hibernate.org

Newbie Joined: Thu May 05, 2005 5:54 am Posts: 17 Hi have a problem with a "table per concrete class" inheritance mapping using firebird 1.5 and hibernate 3.0.5. When i select data from tables Hibernate generates a query that does not work with firebird. The query uses the syntax "select * from (select ...) that is not supported on firebird 1.5. ...

80. select next val from dual    forum.hibernate.org

81. PropertyAccessException when using multiple select list box    forum.hibernate.org

Beginner Joined: Sat Mar 04, 2006 1:07 am Posts: 26 Need help with Hibernate? Read this first: http://www.hibernate.org/ForumMailingli ... AskForHelp 3.1.2 I have problem when persisting a user object which contains a set with roles in it when a web form is submitted. I have junit tested the DAO and service layer and even using a MockHttpServletRequest object (from Spring) to ...

82. How select * from tab works in hibernate.    forum.hibernate.org

Newbie Joined: Wed May 10, 2006 5:34 am Posts: 7 Hi david, iam able to get the table details from this query , but problem is in mapping class only. select * from all-TAbles where owner='SCHEMA_NAME'; In this list iam not geting primary key to mention in *.hbm.xml file where i have to give tablename and id's. IAm tracing the problem ...

83. Does Hibernate support Union Selects?    forum.hibernate.org

84. Select with Criteria    forum.hibernate.org

85. HQL Query: FROM(SELECT...    forum.hibernate.org

Hello!! I'm spanish (sorry for my bad english). I need to do a HQL Query but I've an error with the "(" ... I want to translate this: SELECT a.id, b.name,.... FROM ( SELECT a.id, b.name, c.adress..... FROM....... ...... ) GROUP BY a.id, b.name.... to HQL query Can anyone of you help me?? Thank you.

86. How to select optional many-to-one    forum.hibernate.org

I'm using Hibernate 3.2.0CR1 (distributed with JBoss 4.0.4 GA). I have an entity that looks like this (just mentioning the meaningful attributes): Code: @Entity public class SomeEntity { @Id private Integer id; @ManyToOne(optional = true) @JoinColumn(name = "OTHER", nullable = true) ...

87. just simple SELECT    forum.hibernate.org

Hallo, i am new to Hibernate and i dont really know where the problem is. I wanted to execute just a simple SQL statement. My debug informations end with: DriverManagerConnectionProvider:109 - opening new JDBC connection Can anyoune help me ? Thank you seven-12 Hibernate version:3 Mapping documents:

88. Hibernate HQL select Query    forum.hibernate.org

Hi, I'm getting a java.lang.NullPointerException when i'm executing the following query. String query ="select XYZBEan from XYZBEan" + "where corrd = :corrId" +" and status = :status"; Query q = sess.createQuery(query); q.setParameter("corrd ",corrd ); q.setInteger(status,status); q.executeUpdate(); here the XYZBean is a HibernateBean. I'm new to Hibernate, need some guidance on how to write HQL queries.... Thanks in advance. Kris

89. 7.4.2. one to one - causes N+1 selects    forum.hibernate.org

Hibernate version: 3.1.3 We have an immutable table, representing customer data. To add additional, application specific data, we use an optional 'extras' table in a schema which matches section 7.4.2 "A bidirectional one-to-one association on a primary key uses the special id generator". Using the example from the docs, if the Address doesn't exists for all Persons, then in the TwoPhase ...

90. select    forum.hibernate.org

Thank you. But i still have one question : i have this select query: session.createQuery("select meta.titel, meta.url, meta.picture, meta.text from lm_meta as meta, lm_word as word, lm_word_to_meta as meta_word where word.word = '" + dest+ "' and word.id = meta_word.word_id and meta_word.meta_id = meta.id ORDER BY meta.time DESC LIMIT 1") I need titel, url, picture, text from table meta. I put ...

91. select new    forum.hibernate.org

hello, i'm trying to retrieve a list of countries (country Id, code and code value)...i'm new...i'm sure there must be something missing in the method below...pls help class LgItem { private BigDecimal lgItemId; private BigDecimal lgGroupId; private BigDecimal langId; private String cd; private String cdVal; } class CcaCountries { private BigDecimal countryId; private String countryCd; } class CountriesListDTO { private BigDecimal ...

92. About select query?    forum.hibernate.org

93. How many select?    forum.hibernate.org

I'm using Hibernate 3.1.3 This is a simple class model public abstract Cat { private String name; private int age; public abstract boolean processAge(); // setter and getter methods ........ } public BigCat{ public boolean processAge(){ ........... } } public LittleCat{ public boolean processAge(){ ........... } } (In real enviroment I have about ten subclass) and a mapping like:

94. HQL With Select vs Without    forum.hibernate.org

Lets say I have the following 2 HQL's: FROM Cat c WHERE c.id > :id This should return me a List with a list with Cat objects right? Now lets say I have SELECT c.Name FROM Cat c WHERE c.id > :id I should recieve a list with Cat objects, but only the Name member is populated. Correct? Because what is ...

95. how to write a hql along with "`" for select state    forum.hibernate.org

Need help with Hibernate? Read this first: http://www.hibernate.org/ForumMailingli ... AskForHelp Hibernate version:[Un known] [b]Mapping documents: ...

96. how to use select query in hibernate    forum.hibernate.org

Hi guys I created a table sample and mapped in config.xml.When i tried to insert through java by create query method . it shows me error org.hibernate.hql.ast.QuerySyntaxException: sample is not mapped [select sam_id,sam_name from sample sample] at org.hibernate.hql.ast.util.SessionFactoryHelper.requireClassPersister(SessionFactoryHelper.java:158) at org.hibernate.hql.ast.tree.FromElementFactory.addFromElement(FromElementFactory.java:87) at org.hibernate.hql.ast.tree.FromClause.addFromElement(FromClause.java:70) at org.hibernate.hql.ast.HqlSqlWalker.createFromElement(HqlSqlWalker.java:265) at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElement(HqlSqlBaseWalker.java:3056) at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElementList(HqlSqlBaseWalker.java:2945) at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromClause(HqlSqlBaseWalker.java:688) at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:544) at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:281) at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:229) at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:228) at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:160) at ...

97. inner select in HQL possible?    forum.hibernate.org

I'm attempting to write an HQL statement that uses an inner select, but Hibernate's complaining about invalid syntax. I'm fairly certain I've got something wrong, but I can't find information about how to do an inner select with HQL. I'm attempting to select object a in two buckets - those with a b.name of 'FOO', and those with either no b ...

98. Hibernate creates a very very very long select    forum.hibernate.org

Page 1 of 1 [ 4 posts ] Previous topic | Next topic Author Message stianwest Post subject: Hibernate creates a very very very long select Posted: Thu Feb 22, 2007 6:52 am Newbie Joined: Thu Feb 22, 2007 6:44 am Posts: 3 Hello. I have a motor table and I ...

99. Select new User(...)    forum.hibernate.org

Have you created that User as just a value object or is it a domain object (including hbm)? If its a domain object, then you'd need to take a look at it to see what it has and also since User is mapped, when you execute the hql, it loads up all the "users" from this table, thereby issuing multiple queries. ...

100. execute select operation with Criteria    forum.hibernate.org

Dear Sirs I need to make ' select ' operation by hibernate Criteria IP with some conditions. In SQL my query is like this one: HibernateSupport hibernateSupport = new HibernateSupport(); String query = "select t from TextVersion as t where version = " + "(select max(version) from TextVersion where headline_id = " + headlineId + ") and headline_id=" + headlineId; List ...