[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-4587?page=c...
]
Marcos Antonio de Vasconcelos Junior updated HHH-4587:
------------------------------------------------------
Attachment: HibernateEmbeddedBug.java
TestCase simplified to reproduce the error.
Assuming the DataBase and tables are created.
Criteria.createAlias : QueryException on @Embedded attributes
-------------------------------------------------------------
Key: HHH-4587
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-4587
Project: Hibernate Core
Issue Type: Bug
Components: annotations, core, query-criteria
Affects Versions: 3.3.0.GA
Environment: Hibernate 3.3.0
MySql 5.1.29
Reporter: Marcos Antonio de Vasconcelos Junior
Attachments: HibernateEmbeddedBug.java
Original Estimate: 1 week
Remaining Estimate: 1 week
Hi, recently i discover my app always throws a Exception when searching with alias in
@Embedded fields.
The model look like this.
[code]
@Embeddable
public class Contato {
//attrs
}
@Table
@Entity(name = "motorista")
public class Motorista {
@Embedded
private Contato contato;
//+attrs
}
[/code]
And the following code:
[code]
Session s = HibernateUtil.openSession();
Criteria crit = s.createCriteria(Motorista.class);
crit.createAlias("contato", "contato");
crit.add(Restrictions.like("contato.nome", "jo",
MatchMode.ANYWHERE));
System.out.println(crit.list().size());
[/code]
Always throws QueryException and the StackTrace:
[code]
Exception in thread "main" org.hibernate.QueryException: could not resolve
property: nome of: br.com.sistram.model.prestador.Motorista
at
org.hibernate.persister.entity.AbstractPropertyMapping.propertyException(AbstractPropertyMapping.java:44)
at
org.hibernate.persister.entity.AbstractPropertyMapping.toType(AbstractPropertyMapping.java:38)
at
org.hibernate.persister.entity.AbstractEntityPersister.getSubclassPropertyTableNumber(AbstractEntityPersister.java:1379)
at
org.hibernate.persister.entity.BasicEntityPropertyMapping.toColumns(BasicEntityPropertyMapping.java:31)
at
org.hibernate.persister.entity.AbstractEntityPersister.toColumns(AbstractEntityPersister.java:1354)
at
org.hibernate.loader.criteria.CriteriaQueryTranslator.getColumns(CriteriaQueryTranslator.java:434)
at
org.hibernate.loader.criteria.CriteriaQueryTranslator.getColumnsUsingProjection(CriteriaQueryTranslator.java:394)
at org.hibernate.criterion.SimpleExpression.toSqlString(SimpleExpression.java:45)
at
org.hibernate.loader.criteria.CriteriaQueryTranslator.getWhereCondition(CriteriaQueryTranslator.java:334)
at
org.hibernate.loader.criteria.CriteriaJoinWalker.<init>(CriteriaJoinWalker.java:90)
at
org.hibernate.loader.criteria.CriteriaJoinWalker.<init>(CriteriaJoinWalker.java:59)
at org.hibernate.loader.criteria.CriteriaLoader.<init>(CriteriaLoader.java:67)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1550)
at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283)
at br.com.sistram.util.DaoListPaginator.main(DaoListPaginator.java:160)
[/code]
When looking for a solution i discover this problem don't occurs when I use the
@OneToMany + @JoinColumn annotations instead of @Embedded.
No one in hibernate forums and in a brazilian forum I'm member can't help, so I
think it's a bug.
--
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