INDEX « Query « JPA Q&A





1. HQL to return the index of an object in an ordered query result?    stackoverflow.com

Can I use HQL to get the index of an ordered query result? The only way I know to do this is to get back all of the results from the ...

2. HQL for finding starting index of objects in a predefined order?    stackoverflow.com

Using HQL, I would like to search for the starting index of sequenced objects. For example, if I have the following persisted classes:

<class name="Word">

 <id name="id" type="int">
  <meta attribute="scope-set">protected</meta>
  <generator ...

3. Specifying index in HQL queries    stackoverflow.com

Is there a way to specify which index to use, in HQL, to retrieve values from a MySQL table that has an index defined?

4. Hibernate: What am I missing? Can't find @Id, instead @Index    stackoverflow.com

Every example I have found uses @Id, but when I try to write my code, many of the annotations that I'm used to are gone, there are annotatoins like @Index, and ...

5. How many indexes should be created for faster queries    stackoverflow.com

My object model is given below and would like your inputs on the number of indexes to create for faster query responses (on h2, mysql). Assumptions and questions are given below ...

6. How do I specify the order of columns within a multi-column index in Hibernate?    stackoverflow.com

I'm creating a multi-column index as follows:

@Entity
public class Ranking extends Model {
    @ManyToOne
    @Index(name = "ranking_ix")
    public Rankable rankable;

    ...

7. how to skip an index in a tuple result from a sql query    stackoverflow.com

I unfortunately need to use 'native' sql queries for a portion of my project to return tuples from unmapped tables. I have a bunch of queries which are supposed to return the ...

8. Multiple indexes on one column    stackoverflow.com

Using Oracle, there is a table called User. Columns: Id, FirstName, LastName Indexes: 1. PK(Id), 2. UPPER(FirstName), 3. LOWER(FirstName), 4. Index(FirstName) As you can see index 2, 3, 4 are indexes on the same ...

9. Getting Invalid parameter index 1 from simple HQL query    stackoverflow.com

I have the following HQL query and for simplicity sake lets assume the mappings and table names are correct.

String queryString = "from entity as vv inner join vv.childentity as vis with ...





10. Using "FORCE INDEX" clause in HQL    coderanch.com

Hello people, Does anybody know whether is possible to include the "FORCE INDEX" clause in an HQL sentence? Due to what seems to be a MySQL bug the best index of a table has not been used and this is causing performance loss. The problem can be fixed in pure SQL using the clause "FORCE INDEX" but in HQL it cannot ...

11. Hibernate create tables,column order and indexes    coderanch.com

I have this setting in the hibernate.cfg.xml update and defined a class like this import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import org.hibernate.annotations.Index; import org.hibernate.annotations.Table; @Entity @javax.persistence.Table(name="testtable") @Table(appliesTo="testtable",indexes={@Index(name="idx",columnNames={"edad","nombre"})}) public class Prueba extends model { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) private long serial; private String nombre; private int edad; ... I want to create the table at the start of the process. But ...

12. Hinting which MySQL index to use on a select    forum.hibernate.org

I have a table with a Deleted column and a multi-field index. Unfortunately the index on the Deleted column is used instead of the multi-field index which results in unacceptable performance. Since I'm using the 'like' operator on one of the muti-field index columns in the where clause, it doesn't seem to matter how I rearrange the query. I need to ...

13. Hibernate create tables,column order and indexes    forum.hibernate.org

I have this setting in the hibernate.cfg.xml update and defined a class like this Code: import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import org.hibernate.annotations.Index; import org.hibernate.annotations.Table; @Entity @javax.persistence.Table(name="testtable") @Table(appliesTo="testtable",indexes={@Index(name="idx",columnNames={"edad","nombre"})}) public class Prueba extends model { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) private long serial; ...

14. query.getResultList throws String index out of range    forum.hibernate.org

Dear All, I am get following error while getting result list from a JPQL query. java.lang.StringIndexOutOfBoundsException: String index out of range: 14833 at java.lang.String.charAt(String.java:686) at org.hibernate.util.StringHelper.replace(StringHelper.java:107) at org.hibernate.util.StringHelper.replace(StringHelper.java:111) at org.hibernate.impl.AbstractQueryImpl.expandParameterList(AbstractQueryImpl.java:749) at org.hibernate.impl.AbstractQueryImpl.expandParameterLists(AbstractQueryImpl.java:718) at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102) at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:67) It is happening only under heavy load on the system. It is not for any particular query but once we get it for any query ...

15. Select row in hql by index    forum.hibernate.org

16. how to find the index of an object inside a set?    forum.hibernate.org

could you give me another hint as to how I can do this? i've already looked into the session.filter but not sure what the query would even look like I just have that Person object loaded and want to know the position of the Person within a List of Person objects, I can already do this using using List.indexOf but that ...





17. would like to see arrays without relying on an index column    forum.hibernate.org

I know why Hibernate doesnt do this, and I respect how Hibernate does everything by the book (e.g. arrays have an ordering, and a normal one-to-many doesnt, also arrays allow multiple references to the same element and sets and normal DB relationships do not), however, sometimes a product can be flexible to help integrate with the most situations. We have a ...

18. Help in querying index-many-to-many    forum.hibernate.org

Hibernate version:2.1.6 I am trying to execute a query that uses the key of the Map in the where condition trying to find All partner products that have a choice id of 10. here is the query select pp from PartnerProduct pp, pp.products.choices.indices choices where choices.id = 10 The query formed by hibernate does not give the desired results. The where ...

19. USE INDEX (index_name) option in Criteria queries    forum.hibernate.org

Hibernate version: 3.1 Name and version of the database you are using: MySQL 4.1 (but valid on any MySQL and probably other DB too) I love the Criteria API, it solves my current problems quite well. But I believe it could be made even more flexible. I currently had performances problems in a range of SQL queries, and the way to ...

21. How do you use the HQL ORDER BY on an indexed collection?    forum.hibernate.org

Hibernate version: 2.1 In the WHERE clause you can specify the key with props.['key'] which is incredibly convenient. How do I order by the same value though? In the ORDER BY clause, the same syntax gives me a " net.sf.hibernate.QueryException: Incorrect query syntax " Here's the query: select distinct ga from GroupAsset ga where ga.metadata.properties['Version'] between :verStart and :verEnd order by ...

22. Removing Index Causes Mass Hydration from HQL Query    forum.hibernate.org

Without changing any code, a given HQL query which does not hydrate child nodes begins to hydrate the child nodes after removing an index directly from the database. There were no updates done to the hbm.xml file nor any change to the code. The object being queried is reasonably complex. lazy loading is enabled for the relationships. It seems strange that ...

23. Wrong SQL for select with collection index    forum.hibernate.org

I use Hibernate 3.1.1 and Oracle 10. I have a table "customer" with an ordered collection (list) "comchannels" containing phone numbers, fax numbers, e-mail addresses and the like. This is from the code of Customer.java: Code: /** * Referenced com channels * @hibernate.list cascade="all-delete-orphan" lazy="false" inverse="false" ...

25. Hibernate binds index query variable to wrong position    forum.hibernate.org

task_seq

26. quantumdb, query speed improvements after index    forum.hibernate.org

27. Querying an indexed table through Query by example    forum.hibernate.org

Hi, I am facing a problem with using the indexes created on my database through a hibernate Query by Example. Here are the details- TABLE- PERSON ============= Name Address City Country The index is on Name column. Now when i use the Example object and query this table the hibernate generated query always reads- where CITY=... and NAME = ... Because ...

28. Querying an indexed table through Query by example    forum.hibernate.org

Hi, I am facing a problem with using the indexes created on my database through a hibernate Query by Example. Here are the details- TABLE- PERSON ============= Name Address City Country The index is on Name column. Now when i use the Example object and query this table the hibernate generated query always reads- where CITY=... and NAME = ... Because ...

29. Querying an indexed table through Query by example    forum.hibernate.org

Hi, I am facing a problem with using the indexes created on my database through a hibernate Query by Example. Here are the details- TABLE- PERSON ============= Name Address City Country The index is on Name column. Now when i use the Example object and query this table the hibernate generated query always reads- where CITY=... and NAME = ... Because ...

30. Trouble creating dinamic query to index entity with jpa    forum.hibernate.org

I'm trying index with Hibernate Search; Code: EntityManager em = this.getEntityManager(); FullTextEntityManager fullTextEntityManager = org.hibernate.search.jpa.Search.createFullTextEntityManager(em); log.debug("Starting initial indexing."); for (int i = 0; i < part.size(); i++) { ...