There are two entities:
@Entity
@Inheritance(strategy = InheritanceType.JOINED)
public class Person implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
...
}
@Entity
public class Man extends Person {
...
}
Trying to execute the following method:
@Test
public void clear(EntityManager em) {
EntityTransaction tx = em.getTransaction();
tx.begin();
System.out.println(em
.createQuery("delete from Man m where m.id > 14582647")
.executeUpdate());
tx.commit();
}
Get the error:
[ERROR] ORA-00918: column ambiguously defined
hibernate.show_sql shows sql-queries:
Hibernate: insert into HT_Man select man0_.id as id from Man man0_ inner join Person man0_1_ on man0_.id=man0_1_.id where id=14582647
Hibernate: delete from HT_Man
The error occurs in a place where id = 14582647 as there must be more than just id, and for example man0_.id. How to generate the correct sql-query?