[hibernate-issues] [Hibernate-JIRA] Updated: (HHH-5301) Add support for parametrizing TYPE(e) expressions
Michael Rudolf (JIRA)
noreply at atlassian.com
Mon Nov 8 12:05:13 EST 2010
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-5301?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Michael Rudolf updated HHH-5301:
--------------------------------
Attachment: query-test-type-expression.patch
git diff for trunk containing a failing test case
> Add support for parametrizing TYPE(e) expressions
> -------------------------------------------------
>
> Key: HHH-5301
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5301
> Project: Hibernate Core
> Issue Type: Bug
> Components: query-hql
> Affects Versions: 3.5.2
> Environment: Hibernate 3.5.2, Java 6.0.20
> Reporter: Luis Fernando Planella Gonzalez
> Assignee: Gail Badner
> Attachments: query-test-type-expression.patch
>
>
> Support parameters for JPA 2's TYPE(alias) function.
> Test classes:
> @Entity
> @DiscriminatorColumn(name="subclass")
> @Table(name="xs")
> public abstract class XBase {
> @Id
> private Integer id;
> public Integer getId() {
> return id;
> }
> public void setId(Integer id) {
> this.id = id;
> }
> }
> @Entity
> @DiscriminatorValue("x1")
> public class X1 extends XBase {
> @Basic
> private String x1;
> public String getX1() {
> return x1;
> }
> public void setX1(String x1) {
> this.x1 = x1;
> }
> }
> @Entity
> @DiscriminatorValue("x2")
> public class X2 extends XBase {
> @Basic
> private String x2;
> public String getX2() {
> return x2;
> }
> public void setX2(String x2) {
> this.x2 = x2;
> }
> }
> Running the following query works: "select x from XBase x where type(x) = X1"
> However, the following one: "select x from XBase x where type(x) = :t" yelds
> Exception in thread "main" java.lang.UnsupportedOperationException: At the moment this type is not the one actually used to map the discriminator.
> at org.hibernate.persister.entity.DiscriminatorType.nullSafeSet(DiscriminatorType.java:111)
> at org.hibernate.param.NamedParameterSpecification.bind(NamedParameterSpecification.java:67)
> at org.hibernate.loader.hql.QueryLoader.bindParameterValues(QueryLoader.java:567)
> at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1612)
> at org.hibernate.loader.Loader.doQuery(Loader.java:717)
> at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:270)
> at org.hibernate.loader.Loader.doList(Loader.java:2294)
> at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2172)
> at org.hibernate.loader.Loader.list(Loader.java:2167)
> at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:448)
> at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:363)
> at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196)
> at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1258)
> at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102)
> at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:241)
> at test.Main.main(Main.java:28)
> JPA 2's spec explicitly shows querying by type using parameters in section 4.6.17.4.
--
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.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list