[Hibernate-JIRA] Created: (HHH-2354) Schema validation too rigid for MySql enums
by Zeljko Trogrlic (JIRA)
Schema validation too rigid for MySql enums
-------------------------------------------
Key: HHH-2354
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2354
Project: Hibernate3
Type: Bug
Components: metamodel
Environment: jboss-seam-1.1.0.GA, MySQL 5
Reporter: Zeljko Trogrlic
Enum column type in MySQL is handled as CHAR in their JDBC driver and should be mapped to String Java type.
However, Hibernate expects varchar(n) and fails to do the validation.
This is how DatabaseMetaData.getColumns describes it:
DATA_TYPE=1
TYPE_NAME=enum
Note that although TYPE_NAME is enum, DATA_TYPE represents CHAR.
Hibernate reports following exception:
13:49:31,397 INFO [TableMetadata] table found: configuration.userdb_domain_acl
13:49:31,397 INFO [TableMetadata] columns: [id, enabled, tablename, domain]
13:49:31,397 WARN [ServiceController] Problem starting service persistence.units:ear=msmgui.ear,unitName=msmgui
javax.persistence.PersistenceException: org.hibernate.HibernateException: Wrong column type: enabled, expected: varchar(
2)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:698)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:127)
at org.jboss.ejb3.entity.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:264)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Validation should be fixed/relaxed to avoid this problem.
--
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
15 years, 11 months
[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
15 years, 12 months
[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