[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-6548) Criteria query involving column @MapKeyJoinColumn
Anil G (JIRA)
noreply at atlassian.com
Thu Aug 4 23:41:02 EDT 2011
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-6548?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=43179#comment-43179 ]
Anil G commented on HHH-6548:
-----------------------------
database tables has following relationship
{code}
Employee -----------< Emp_Field
Field_Def ----------< Emp_Field
Field_Value --------< Emp_Field
{code}
> 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
More information about the hibernate-issues
mailing list