Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7432219
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T09:25:27+00:00 2026-05-29T09:25:27+00:00

I have a JSF webapp throwing an exception (see below) when I’m trying to

  • 0

I have a JSF webapp throwing an exception (see below) when I’m trying to query for entities mapped with Hibernate. What am I doing wrong? Or is it a Bug in Hibernate? How can I fix that? Thanks for your help 🙂

Here are the relevant classes:

Base class ShipmentUnit with some sub-classes:

@Entity
@Table(name = "tat_shipment_unit")
@Inheritance(strategy = SINGLE_TABLE)
@DiscriminatorColumn(name = "unit_type", discriminatorType = CHAR, length = 1)
@DiscriminatorValue("_")
public abstract class ShipmentUnit implements Serializable {
    private Long id;
    private List<ShipmentAction> actions;

    @Id @GeneratedValue
    public Long getId() { return id; }  // and corresponding setter

    @OneToMany(mappedBy = "unit")
    @OrderBy("listIndex")
    public List<ShipmentAction> getActions() { return actions; }  // and setter

    // hashCode, equals etc.
}

The ShipmentAction class:

@Entity
@Table(name = "tat_shipment_action")
@IdClass(ShipmentActionID.class)
public class ShipmentAction implements Serializable {
    private ShipmentUnit unit;
    private int listIndex;

    @Id @ManyToOne @NotNull
    public ShipmentUnit getUnit() { return unit; }  // and setter

    @Id @Column(name = "list_index", nullable = false)
    public int getListIndex() { return listIndex; } // and setter
}

The ShipmentActionID class also has the unit and listIndex properties with the same signatures on the getter and setter methods.

Now, I want to display a h:dataTable with a LazyDataModel<ShipmentAction>. The implementation of the data model uses the Criteria API to (1) count and (2) query for those shipment action entities, like so:

CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Number> query = cb.createQuery(Number.class);
Root<ShipmentAction> root = query.from(ShipmentAction.class);
Predicate predicates = ...
int total = em.createQuery(
    query.select(cb.count(root).where(predicates)
).getSingleResult().intValue();

At the moment the TypedQuery should be created with em.createQuery(...) an exception is being thrown:

[SEVERE] Error Rendering View[/tat/report/actions.xhtml]: java.lang.IllegalStateException: No supertype found
at org.hibernate.ejb.metamodel.AbstractIdentifiableType.requireSupertype(AbstractIdentifiableType.java:85)
at org.hibernate.ejb.metamodel.AbstractIdentifiableType.getIdType(AbstractIdentifiableType.java:173)
at org.hibernate.ejb.criteria.expression.function.AggregationFunction$COUNT.renderArguments(AggregationFunction.java:110)
at org.hibernate.ejb.criteria.expression.function.ParameterizedFunctionExpression.render(ParameterizedFunctionExpression.java:94)
at org.hibernate.ejb.criteria.expression.function.BasicFunctionExpression.renderProjection(BasicFunctionExpression.java:71)
at org.hibernate.ejb.criteria.QueryStructure.render(QueryStructure.java:250)
at org.hibernate.ejb.criteria.CriteriaQueryImpl.render(CriteriaQueryImpl.java:338)
at org.hibernate.ejb.criteria.CriteriaQueryCompiler.compile(CriteriaQueryCompiler.java:223)
at org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:619)

I am using Hibernate Version 4.0.0.Final, running on JBoss AS 7.

        <dependency>
        <groupId>org.hibernate.javax.persistence</groupId>
        <artifactId>hibernate-jpa-2.0-api</artifactId>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.jboss.spec.javax.ejb</groupId>
        <artifactId>jboss-ejb-api_3.1_spec</artifactId>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.jboss.spec.javax.annotation</groupId>
        <artifactId>jboss-annotations-api_1.1_spec</artifactId>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>javax.enterprise</groupId>
        <artifactId>cdi-api</artifactId>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>javax.validation</groupId>
        <artifactId>validation-api</artifactId>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-validator</artifactId>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-core</artifactId>
        <version>4.0.0.Final</version>
        <scope>provided</scope>
    </dependency>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T09:25:28+00:00Added an answer on May 29, 2026 at 9:25 am

    I found a solution to my problem. I changed the mapping of the dependent class ShipmentAction by using an @EmbeddedId instead of two @Id annotations. In case you’re interested, here is the updated class (the mapping of the ShipmentUnit class has not changed 1)

    @Entity
    @Table(name = "tat_shipment_action")
    public class ShipmentAction implements Serializable {
        private @EmbeddedId Key id;
        private @MapsId("unit_id") @ManyToOne ShipmentUnit unit;
    
        public ShipmentAction() {
            id = new Key();
        }
    
        public ShipmentUnit getUnit() { return unit; }  // and setter
    
        public int getListIndex() {
            return id.list_index;
        }
    
        public void setListIndex(int index) {
            id.list_index = index;
        }
    
        @Embeddable
        public static class Key implements Serializable {
            public long unit_id;
            public int list_index;
            // hashCode() and equals()
        }
    }
    

    Okay, this seems to work and my LazyDataModel<ShipmentAction> likes it now 🙂
    But the only strange thing is, that this only works with JPA annotations on the fields, Hibernate can’t cope with these annotations on the getter-methods anymore (at least on the classes affected by my change). Any thoughts on that one?

    1 One other little change: the @javax.persistence.OrderBy annotation at ShipmentUnit.getActions() had to be replaced with @org.hibernate.annotations.OrderBy for whatever reason.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When you use JSF, you'll have the controller servlet javax.faces.webapp.FacesServlet that will be mapped
In my JSF 1.2 webapp I have a page with a <h:commandButton> that invokes
I have an ajax webapp (JSF 2.0) that uses hash for navigation. I've used
In a JSF application, we have the directory hierarchy: webapp xhtml login.xhtml main.xhtml search.xhtml
I have an error page error.jsf mentioned in the web.xml : <error-page> <exception-type>javax.faces.application.ViewExpiredException</exception-type> <location>/viewExpired.jsp</location>
I'm doing a JSF 2.0 application on Tomcat 6.x. I have a resource bundle
I have JSF code like: <h:inputText id=from value=#{fromToMBean.fromName}/> I would like to get this
I have a JSF application that uses mostly Richfaces. I would like to introduce
I have a JSF web client and a Java client that both use the
i have a JSF web application. I use Beans as Spring Beans (not JSF

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.