[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-6548?page=c...
]
Gail Badner commented on HHH-6548:
----------------------------------
Your mapping does not look to be in synch with criteria query code.
Shouldn't the alias be defined for "attributes" and shouldn't the
restriction be defined on "cf.value.value"?
If you are still having problems, please fork the git repo at
https://github.com/hibernate/hibernate-core, add a test case that reproduces your issue,
and create a pull request.
Thanks,
Gail
Criteria query involving column @MapKeyJoinColumn
-------------------------------------------------
Key: HHH-6548
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-6548
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.6.6
Reporter: Anil G
Priority: Critical
Labels: Criteria, MapKeyColumn
Following is object relationship:
Employee mapping contains
{code:title=Mapping}
@OneToMany(cascade = CascadeType.ALL)
@JoinTable(name = "Emp_Field", joinColumns = @JoinColumn(name =
"emp_id"), inverseJoinColumns = @JoinColumn(name = "field_value_id"))
@MapKeyJoinColumn(name = "field_def_id")
public Map<FieldDef, FieldValue> getAttributes() {
return attributes;
}
{code}
*CRUD* works amazingly!, but there exists *Critcal* issue with querying such a fields and
adding *Order By*
{code:title=works only value part of query}
DetachedCriteria criteria = DetachedCriteria.forName(Employee.class);
criteria = criteria.createAlias("fields","cf");
criteria = criteria.add(Restrictions.eq("cf.value","boonga"));
List<Employee> list = getHibernateTemplate().findByCriteria(criteria);
{code}
It does not permit query invloving Map.key object and Map.value object. as well as does
not permit order by Map.key object...
{code}
fields.key.fieldDef.name="DirectPhone"
fields.value.value = "777%"
{code}
--
This message is automatically generated by JIRA.
For more information on JIRA, see:
http://www.atlassian.com/software/jira