]
scLee commented on HHH-4581:
----------------------------
Pardon me. There's no issue in 3.6-Final. I was using the wrong version.
Embedded objects in criteria API does not work
----------------------------------------------
Key: HHH-4581
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-4581
Project: Hibernate Core
Issue Type: Bug
Components: entity-manager, query-criteria
Affects Versions: 3.5.0-Beta-2
Reporter: Jaroslaw Lewandowski
Assignee: Steve Ebersole
Priority: Blocker
Fix For: 3.5.0-Beta-3
Attachments: Client.java, CriteriaApiTest.java, Name.java
Time Spent: 2h
Remaining Estimate: 0h
It not possible to use Embedded attribute in Criteria API. E.g. having the following
entity
@Entity
class Client {
@Embedded
private Name name;
}
@Embeddable
public class Name implements Serializable {
@Basic
private String firstName;
@Basic
private String lastName;
}
The following throws an exception
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<ClientCard> cq = cb.createQuery(Client.class);
Root<ClientCard> root = cq.from(ClientCard.class);
cq.where(cb.equal(root.get(Client_.name).get(Name_.firstName)), "blah");
em.createQuery(cq).getResultList();
Saying that Name is not managed entity:
Caused by: java.lang.IllegalArgumentException: Not an managed type: class
com.phorest.memento.server.domain.Name
at org.hibernate.ejb.metamodel.MetamodelImpl.managedType(MetamodelImpl.java:171)
at org.hibernate.ejb.criteria.JoinImpl.<init>(JoinImpl.java:54)
at org.hibernate.ejb.criteria.FromImpl.constructJoin(FromImpl.java:193)
at org.hibernate.ejb.criteria.FromImpl.join(FromImpl.java:176)
at org.hibernate.ejb.criteria.FromImpl.join(FromImpl.java:169)
at org.hibernate.ejb.criteria.FromImpl.get(FromImpl.java:559)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: