| I have the following classes:
@Entity(name = "sc.Parent")
public abstract class Parent;
@Entity(name = "sc.ChildA")
@Table(name = "SC_child_A")
public abstract class ChildA extends Parent;
@Entity(name = "sc.ChildB")
@Table(name = "SC_child_B")
public abstract class ChildB extends Parent;
When I try to run a simple delete from sc.Parent query, hibernate generates the following SQL statement, which fails:
INSERT INTO MODULE.HT_sc.Parent
SELECT parent0_.id AS id
FROM (
SELECT id
,child_A_property
,2 AS clazz_
FROM SC_child_A
UNION ALL
SELECT id
,child_B_property
,3 AS clazz_
FROM SC_child_B
) parent0_
This statement fails with the following error:
Caused by: org.hsqldb.HsqlException: user lacks privilege or object not found: PARENT
I also tried using an Oracle DB, and I got a similar error. I found a work around for this, if I remove the dot ('.') character from the Parent entity name, the delete statement works fine. It looks like the generated temporary table name is not valid because of the dot character in the original entity name. It would be nice to be able to use the dot ('.') character in the entity name without running into these kinds of problems. Please either add support for this, or log some warning that this is not supported. I tried to provide a very simple example that should reproduce the issue. If more information is required I'd be happy to help. |