[Hibernate-JIRA] Created: (HHH-4587) Criteria.createAlias : QueryException on @Embedded attributes
by Marcos Antonio de Vasconcelos Junior (JIRA)
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
Priority: Blocker
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
15 years
[Hibernate-JIRA] Assigned: (HHH-1352) Session.setReadOnly(Object, boolean) fails for proxies
by Gail Badner (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1352?page=c... ]
Gail Badner reassigned HHH-1352:
--------------------------------
Assignee: Gail Badner (was: Steve Ebersole)
> Session.setReadOnly(Object, boolean) fails for proxies
> ------------------------------------------------------
>
> Key: HHH-1352
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1352
> Project: Hibernate Core
> Issue Type: Bug
> Components: core
> Affects Versions: 3.1
> Environment: Hibernate 3.1, MySQL 5.0.15-nt
> Reporter: Stewart Cambridge
> Assignee: Gail Badner
> Priority: Minor
> Original Estimate: 1 day
> Remaining Estimate: 1 day
>
> Session.setReadOnly(Object, boolean) is broken. It throws a TransientObjectException with the message "Instance was not associated with the session" when the object is quite obvious associated with the current session, because we only just loaded it using Session.load(Class, Serializable)
> Here is a simple JUnit test, for an arbitrary entity:
> public void testReadOnly()
> throws Exception
> {
> User user = (User) session.load(User.class, new Long(7));
> System.out.println("\n=== " + user + " ===");
> session.setReadOnly(user, true);
> }
> This is the exception stack trace:
> org.hibernate.TransientObjectException: Instance was not associated with the session at org.hibernate.engine.StatefulPersistenceContext.setReadOnly(StatefulPersistenceContext.java:1167) at org.hibernate.impl.SessionImpl.setReadOnly(SessionImpl.java:1740) at
> test.persistence.HibernateObjectTest.testReadOnly(HibernateObjectTest.java:30) ....
--
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
[Hibernate-JIRA] Created: (HHH-4628) HQL Parsing improvements
by Frank Daspro (JIRA)
HQL Parsing improvements
------------------------
Key: HHH-4628
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4628
Project: Hibernate Core
Issue Type: Improvement
Components: query-hql
Affects Versions: 3.2.2
Environment: Hibernate 3.22 Ga, Oracle 10g
Reporter: Frank Daspro
Attachments: sql1.txt, sql2.txt
The same HQL is being parsed/mangled differently on different servers and possibly differently after server restarts. This is causing our Oracle Optimizer to intermittently optimise the SQL differently and requiring manual intervention by our DBAs to re-optimise these queries. I am informed by a Hibernate technical consultant that there is element of randomness in the mangled column name generation.
An example of the HQL parsing inconsistencies are attached. Both outputs are from the identical HQL and producing different mangled column names.
It would be much appreciated if this parsing could be modified to use a deterministic algorithm in producing mangled column names.
--
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