Hi,
I have a class hierarchi. ie A extends B
Now I have two tables A_TABLE and B_TABLE . A_TABLE is mapped to A and B_TABLE IS mapped to B using joined-subclass tag
i.e my a.hbm.xml look like
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated Sep 3, 2008 3:42:54 PM by Hibernate Tools 3.2.1.GA -->
<hibernate-mapping>
<class name="A" table="A_TABLE" >
<id name="aId" type="int">
<column name="A_ID" />
<generator class="identity" />
</id>
/* A's properties follows here */
<joined-subclass name="B table="B_TABEL" >
<key column="A_ID"/>
/* B's properties follows here */
</joined-subclass>
</hibernate>
Now the issue is , when I save B ie when I call session.save (b's object) a new record is getting inserted for A also .i.e new record is inserting into A_TABLE.
How can I restrict A getting saved when I save B ?
Is there anything missing in what I did ? Or is it completey wrong to use "table per concrete class " aproach here ?
Thanks in advance.
Shaiju
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:
Mapping documents:
Code between sessionFactory.openSession() and session.close():
Full stack trace of any exception that occurs:
Name and version of the database you are using:
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt:
Problems with Session and transaction handling?
Read this:
http://hibernate.org/42.html