[Hibernate-JIRA] Created: (EJB-277) allow string values for query hints
by Norman Richards (JIRA)
allow string values for query hints
-----------------------------------
Key: EJB-277
URL: http://opensource.atlassian.com/projects/hibernate/browse/EJB-277
Project: Hibernate Entity Manager
Type: Improvement
Reporter: Norman Richards
It seems that some string values are not accepted as query hint values in hibernate. In specific, I was trying to convert a simple query that uses setHint("org.hibernate.cacheable", true) to use an XML-defined EntityQuery that uses
<framework:entity-query name="allCategories"
ejbql="select c from Category c"
order="c.name">
<framework:hints>
<key>org.hibernate.cacheable</key>
<value>true</value>
</framework:hints>
</framework:entity-query>
Unfortunately, this fails with an IllegalArgumentException:
Caused by: java.lang.IllegalArgumentException: Value for hint
at org.hibernate.ejb.QueryImpl.setHint(QueryImpl.java:160)
at org.jboss.seam.framework.EntityQuery.createQuery(EntityQuery.java:114)
at org.jboss.seam.framework.EntityQuery.getResultList(EntityQuery.java:41)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
...
Although I didn't try it, I would assume this would also fail from a @QueryHint in on a named query since that annotation only accepts a string
value.
I don't think this is technically a bug, but it would be very convenient if all the hints could accept string values.
--
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-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: (ANN-636) Add the annotations to map the User Collection Type
by jason (JIRA)
Add the annotations to map the User Collection Type
---------------------------------------------------
Key: ANN-636
URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-636
Project: Hibernate Annotations
Issue Type: New Feature
Components: binder
Environment: n/a
Reporter: jason
I am searching a way from the Hibernate Annotation to map the user defined collection, and find out the following :
Can anybody let me know what the status for this? or how i can map the user collection type by hibernate annotation, thanks
Add an annotation to specify the UserCollectionType for a OneToMany or ManyToMany.
The annotation is named CollectionTypeInfo, perhaps better named UserCollectionType, but I didn't know the standards for naming classes.
The change to AnnotationBinder is minor and is delineated by '//dwsjoquist//' comment lines.
Usage:
@OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
@JoinColumn(name = "id")
@CollectionTypeInfo(name = "examples.MyUserCollectionType")
public List<ExampleAttribute> getExampleAttributes() {
--
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
[Hibernate-JIRA] Created: (HHH-2787) Criteria Aggregate Projections do not JOIN additional tables on which restrictions apply
by Sami Dalouche (JIRA)
Criteria Aggregate Projections do not JOIN additional tables on which restrictions apply
----------------------------------------------------------------------------------------
Key: HHH-2787
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2787
Project: Hibernate3
Issue Type: Bug
Components: query-criteria
Affects Versions: 3.2.5
Environment: PostgreSQL Dialect
Reporter: Sami Dalouche
Priority: Critical
Hi,
When you have a Criteria Object, on which you :
- Add Aggregate Projections such as rowCount()
- createAlias("whatever").add(Restrictions.*..)
It looks like that the "whatever" table is NOT joined, even though it is joined OK when the projections are not there.
So, here is an approximate Unit test that should throw an exception (I couldn't create a complete test case since I couldn't get the unit tests to run on my machine -any link explaining this step somewhere ?):
Criteria c1 = s.createCriteria(Enrolment.class)
.setProjection( Projections.projectionList().add(Projections.rowCount(), "rowCount") );
Criteria studentCriteria = c1.createAlias("student", "st");
studentCriteria.add(Restrictions.eq("name", "whatevername"));
It should complain saying the "st.name" alias does not exist, because the student class has not been joined.
Regards,
Sami Dalouche
--
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