java.lang.UnsupportedOperationException: At the moment this type is not the one actually used to map the discriminator.

Hibernate JIRA | Luis Fernando Planella Gonzalez | 6 years ago
  1. 0

    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.

    Hibernate JIRA | 6 years ago | Luis Fernando Planella Gonzalez
    java.lang.UnsupportedOperationException: At the moment this type is not the one actually used to map the discriminator.
  2. 0

    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.

    Hibernate JIRA | 6 years ago | Luis Fernando Planella Gonzalez
    java.lang.UnsupportedOperationException: At the moment this type is not the one actually used to map the discriminator.
  3. 0

    Change property bean

    Stack Overflow | 2 years ago | user2983066
    java.lang.UnsupportedOperationException: The user must supply a JDBC connection at org.hibernate.connection.UserSuppliedConnectionProvider.getConnection(UserSuppliedConnectionProvider.java:54)
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Change hibernate.cfg.xml runtime - second part

    Stack Overflow | 2 years ago | user2983066
    java.lang.UnsupportedOperationException: The user must supply a JDBC connection at org.hibernate.connection.UserSuppliedConnectionProvider.getConnection(UserSuppliedConnectionProvider.java:54)
  6. 0

    Issues using ContinuousQueryCaches in Coherence 3.5

    Oracle Community | 6 years ago | 847179
    java.lang.UnsupportedOperationException: PofExtractor must be used with POF-encoded Binary entries; the Map Entry is not a BinaryEntry

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. 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()
    2. Hibernate
      QueryLoader.list
      1. org.hibernate.persister.entity.DiscriminatorType.nullSafeSet(DiscriminatorType.java:111)
      2. org.hibernate.param.NamedParameterSpecification.bind(NamedParameterSpecification.java:67)
      3. org.hibernate.loader.hql.QueryLoader.bindParameterValues(QueryLoader.java:567)
      4. org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1612)
      5. org.hibernate.loader.Loader.doQuery(Loader.java:717)
      6. org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:270)
      7. org.hibernate.loader.Loader.doList(Loader.java:2294)
      8. org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2172)
      9. org.hibernate.loader.Loader.list(Loader.java:2167)
      10. org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:448)
      10 frames
    3. Hibernate HQL/JP-QL Parser
      QueryTranslatorImpl.list
      1. org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:363)
      1 frame
    4. Hibernate
      QueryImpl.list
      1. org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196)
      2. org.hibernate.impl.SessionImpl.list(SessionImpl.java:1258)
      3. org.hibernate.impl.QueryImpl.list(QueryImpl.java:102)
      3 frames
    5. Hibernate EJB
      QueryImpl.getResultList
      1. org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:241)
      1 frame
    6. test
      Main.main
      1. test.Main.main(Main.java:28)
      1 frame