Note that there are some explanatory texts on larger screens.

plurals
  1. POWrongClassException switching from eclipselink to Hibernate
    primarykey
    data
    text
    <p>I had a working code written in pure JPA and running on Glassfish v3.0.1 (eclipselink) I decided to switch persistence provider to hbernate 3.5.1-final and I'm experiencing exceptions in one query that had worked before.<br> All other queries( named queries) work fine. Could someone tell me what is wrong with the one below? I can't make it a named query because I need to sort the job by different parameters. <br>Why are the collections inside Job class not being queried?<br> Thanks for any help</p> <p>javax.persistence.PersistenceException: org.hibernate.WrongClassException: Object with id: 16 was not of the specified subclass: mypackage.Job (Discriminator: )</p> <p>Hibernate:</p> <p>select job0_.id as id7_, job0_.version as version7_, job0_.created as creat ed7_, job0_.error_msg as error5_7_, job0_.priority as priority7_, job0_.retries as retries7_, job0_.status as status7_, job0_.subject as subject7_, job0_.user_id as user10_7_, job0_.DTYPE as DTYPE7_ from test_job job0_ where job0_.user_id=? order by job0_.created DESC limit ?</p> <pre> List foo; String qst = " SELECT e from Job e WHERE e.user = :user "; qst += " ORDER BY e." + orderBy; Query q = em.createQuery(qst); //TypedQuery +List q.setParameter("user", user); q.setMaxResults(length); q.setFirstResult(start); foo = q.getResultList(); </pre> <p>Classes:</p> <pre> @Entity @Table @NamedQueries{} Job extends BaseEntity{ ... @ManyToMany(fetch = FetchType.EAGER) @JoinTable(name = "job_address", joinColumns = @JoinColumn(name = "job_id"), inverseJoinColumns = @JoinColumn(name = "address_id")) @NotNull protected Set FtpAddress> addresses; @OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL) @JoinTable(name = "job_transmission", joinColumns = @JoinColumn(name = "job_id"), inverseJoinColumns = @JoinColumn(name = "transmission_id")) protected Set Transmission> transmissions; } @MappedSuperclass BaseEntity{ int id int version .... } </pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload