[Hibernate-JIRA] Created: (HHH-2077) Providing an escape sequence for Criteria queries
by Tobias Dietl (JIRA)
Providing an escape sequence for Criteria queries
-------------------------------------------------
Key: HHH-2077
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2077
Project: Hibernate3
Type: Improvement
Components: query-criteria
Versions: 3.1.3, 3.2.0 cr1, 3.2.0.cr2, 3.2.0.cr3, 3.2.0.cr4
Environment: Hibernate 3.1.3, MySQL, HSQLDB, Oracle
Reporter: Tobias Dietl
Up to now, there is no way of setting the escape sequence to use for string comparisions with like for Criteria queries.
This is necessary as MySQL on the one hand and HSQLDB / Oracle on the other behave differently...
If you want to search for '_abc' in MySQL, you have to use:
value like '\\_abc'
In Oracle or HsqlDB, you have to use:
value like '\_abc'
If you want to switch to another escape sequence like '|' , you can set it in HQL with value like '|_abc' escape '|'. Unfortunately, there is no way of setting it for Criteria queries, which would force me to rewrite all my Criteria queries in HQL. It would really be nice if the feature/improvement would be added...
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
16 years
[Hibernate-JIRA] Created: (HHH-2629) Enable ordering by association paths
by Jörg Heinicke (JIRA)
Enable ordering by association paths
------------------------------------
Key: HHH-2629
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2629
Project: Hibernate3
Issue Type: Patch
Components: query-criteria
Affects Versions: 3.2.4.sp1
Reporter: Jörg Heinicke
In Hibernate's criteria API ordering is not possible on association properties without explicitly creating aliases.
This also only works on one level, not recursively as it would be needed in the following example.
Criteria criteria = session.createCriteria(Account.class);
Criteria pCriteria = criteria.createCriteria("person");
pCriteria.add(Example.create(person));
pCriteria.createCriteria("company");
criteria.addOrder(Order.asc("person.company.name"));
return criteria.list();
I have changed CriteriaQueryTranslator in a way that it first searches the aliasCriteriaMap, second the associationPathCriteriaMap. And the key used for the search is no longer
StringHelper.root( propertyName );
but
StringHelper.qualifier( propertyName );
>From what I understand this can't break anything since it has always only worked with one '.' in the path. For those cases the key stays the same.
This implementation is still not perfect since
1. you need to create criteria in advance
2. you can't switch between alias and actual association path. The best would probably be to walk the path recursively.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
16 years
[Hibernate-JIRA] Created: (HHH-2546) fetch="select" doesn't work when there are no mapped columns in joined except <key
by Derar Bakr (JIRA)
fetch="select" doesn't work when there are no mapped columns in joined except <key
----------------------------------------------------------------------------------
Key: HHH-2546
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2546
Project: Hibernate3
Issue Type: Bug
Components: core
Affects Versions: 3.2.3
Environment: Windows XP Pro
Reporter: Derar Bakr
java.lang.StringIndexOutOfBoundsException: String index out of range: -2
at java.lang.String.substring(String.java:1768)
at java.lang.String.substring(String.java:1735)
at org.hibernate.persister.entity.AbstractEntityPersister.renderSelect(AbstractEntityPersister.java:2899)
at org.hibernate.persister.entity.SingleTableEntityPersister.generateSequentialSelect(SingleTableEntityPersister.java:647)
at org.hibernate.persister.entity.SingleTableEntityPersister.postInstantiate(SingleTableEntityPersister.java:696)
....
Everything is very simple.
There is stupid code in SelectFragment class, method toFragmentString, line 94. String that is being created there, contains list of fields, like a "f1, f2, f3, ..., fn".
", " is being added in every iteration, without check for it is first iteration.
And in class AbstractEntityPersister., method renderSelect, line 2899, where that method is called, this first ", " is deleted using substring(2). So no check for empty string.
I suggest to add check :)))
I just create dynamic mappings programmatically, so create empty join subclass mappings - and in created table there are no fields by default except foreing key.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
16 years, 1 month