java.lang.UnsupportedOperationException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • 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.
    via by Luis Fernando Planella Gonzalez,
  • 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.
    via by Luis Fernando Planella Gonzalez,
  • Change property bean
    via Stack Overflow by user2983066
    ,
    • 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)
    No Bugmate found.