yufeng wrote:
Hi, I am using Hibernate 3.02 with entity-name feature. However, when I tried to delete an object: session.delete(target), where the target is the object to be deleted, it complaines unknown entity. I looked around and foudn a delete method in SessionImpl class: delete(String entityname, Object obj, boolean iscCascadeDeleteEnabled). I then used this delete. It seems working fine.
Is this a mismatch between Session interface and SessionImpl? How do a delete an object with an entity-name specified? Thanks.
I use session.delete(obj) quite frequently without any issues.
Is the Class of your target object above the same as the one your specifying for the entityname or is it a sub/super class ?
As with most of hibernate, it allows you to specify minimal information and determines the rest for you when possible. But if your class is a subclass that's not mapped, it'll work if you specify the superclass as the entity name, but not if you enter the subcass name.