Joined: Mon Feb 02, 2009 12:41 pm Posts: 5
|
We are using Joined subclass strategy using @Inheritance(strategy=InheritanceType.JOINED) as below.
@entity
@Inheritance(strategy=InheritanceType.JOINED)
class A
{
//some general properties
private String detail;
@transient
public String getDetail()
{
return detail;
}
@transient
public void setDetail(String detail)
{
this.detail = detail;
}
}
@entity
class B extends A
{
//some specific properties
@Column(name = "Detail")
public String getDetail()
{
super.getdetail();
}
public void setDetail(String detail)
{
super.setDetail(detail);
}
}
Similar there are few more classes that extend A.
We are using getdetail and setdetail transient methods in superclass as shown above to access "details" since we need to access the details using class A.
Is this approach correct from hibernate point of view to have transient methods as shown above in the super class? Please suggest if there is any alternate approach?
Is there any other approach that suites the best for this kind of relationship between tables?
One more thing, is joined subclasses strategy has any performance problems?
|
|