Hibernate version: 3.*
Name and version of the database you are using: mySql 5.03
We have 2 tables : parent_table and child_table
the child_table id is equal to the parent_table id.
each table has its own hibernate class:
Code:
@Entity
@Inheritance(strategy=InheritanceType.JOINED)
@Table(name = "parent_table", uniqueConstraints = {})
public class ParentTable implements java.io.Serializable {
...
private int id;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "ID", unique = true, nullable = false, insertable = true, updatable = true)
public int getId() {
return this.id;
}
public void setId(int id) {
this.id = id;
}
...
}
@Entity
@Table(name = "child_table", uniqueConstraints = {})
public class ChildTable extends ParentTable {
...
}
ChildTable expands the ParentTable with some very large data.
we wish to retrieve only the ParentTable information since the information in the child is very large blobs data. However, even when we retrieve by
Code:
getEntityManager().find(ParentTable.class, id)
the result is
ChildTable instance with all its data.
The id of the parent table is generated automatically.
when we used inheritance strategy =
TABLE_PER_CLASS we fail for the generated id issue.
Is there a way to retrieve the ParentTable object?
Your help will be really appreciated.
Thanks!