I'm newer to JBoss EJB3 and Hibernate.
I encountered such a problem:I have a one-to-many relationship between class A and B(A hold a list of B),when i delete one B object(through em.remove(b)),it will raise exception org.hibernate.exception.ConstraintViolationException: could not delete....
I use HSQL as default DB and cascade = CascadeType.ALL,i found that it has generated temp table A_B ,i guess it is because that temp table will refer to table B.Someone can tell me how to resolve this problem?Or just to let Hibernate not generate temp tables?
you have to remove your B from the list in A prior to removing it. otherwise you get the constraint exception. this is normal behaviour.
you can use "mappedby" instead to avoid the m:n table (it is not temp btw.), but then you will have a dependency from B to A and this is not always what you want