[jboss-user] [EJB 3.0] - In relation to Entity hierarchy and EntityManager's behaviou
pyctam
do-not-reply at jboss.com
Sat Apr 28 19:59:12 EDT 2007
I found a strange behaviour of EntityManager for the Entity Hierarchy using JOINED strategy (I have not tested yet other strategies).
Let me assume that I have a hierarchy of joined entities derived from, for example, a Vehicle base class:
| Vehicle
| / | \
| / | \
| / | \
| Ground Air Water
| / | \
| / | \
| / | \
| Airbus Boeing Cessna
| / | \
| / | \
| / | \
| B737 B747 B777
|
When I'm trying to remove a Vehicle entity, entity manager removes all related child records from db (Vehicle->Air->Boeing->B747). It's OK.
When I'm trying to remove a B747 entity, entity manager also removes all ancestor records from db (including Boeing, Air and Vehicle), but I don't need it :-(. I just tried to remove only B747 record, why entity manager supposed that I need to remove all ancestors too? I think that this approach is not right. Because, when I want to remove a B747 record only from db (for example an ailiner with registration number XXXXXX), I didn't want to remove all related ancestors include Vehicle.
When I want to remove just Boeing related records from my db, it means that I just wanted to remove only Boeing records including all its childs (B737, B747 and B777), but not its anchestors (Air and Vehicle).
if you think that my thougts on this subject is not on right way or do not cover OOP concepts, please suggest me some resources and will try to study them to understand inheritance from yours point of view.
--
rustam bogubaev
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4041664#4041664
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4041664
More information about the jboss-user
mailing list