S
sveta
Hi all,
sorry for my not perfect English ...
I have table per subclass situation in my database. So i use
@Inheritance(strategy=InheritanceType.JOINED) to map my entities. When
i try to get the instance of subclass, everithing is OK. In my sql log
i see the query that joins two tables (mapped to superclass and mapped
to subclass that i want to get) and returns the correct result.
BUT, when i want to get the instance of superclass, i see the query
that joins table mapped to superclass and ALL tables mapped as
subclasses, though return only infomation from one header table.
Is such behavior correct? And if I have 20 subclasses (and subtables)?
can i change this behavior somehow?
i have the following structure of entities:
@Entity
@Table(name="X.Ref")
@Inheritance(strategy=InheritanceType.JOINED)
public class Ref implements Serializable{
private Integer id;
@Id @GeneratedValue
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
private String name = "";
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
private String status = "r";
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
}
@Entity
@Table(name="X.OrgAdd")
@PrimaryKeyJoinColumn(name="Pnt")
public class Organization extends Ref {
private String address = "";
private String full_name="";
...
}
@Entity
@Table(name="X.PeopleAdd")
@PrimaryKeyJoinColumn(name="Pnt")
public class Person extends Ref {
private String sex = "";
private String addressfact="";
private String email="";
...
}
@Entity
@Table(name="X.ClientAdd")
@PrimaryKeyJoinColumn(name="Pnt")
public class Client extends Ref {
private String client_code = "";
private String depo_code="";
...
}
and several other subclasses.
I use JBOSS 4.0.5.
thanks in advance.
sorry for my not perfect English ...
I have table per subclass situation in my database. So i use
@Inheritance(strategy=InheritanceType.JOINED) to map my entities. When
i try to get the instance of subclass, everithing is OK. In my sql log
i see the query that joins two tables (mapped to superclass and mapped
to subclass that i want to get) and returns the correct result.
BUT, when i want to get the instance of superclass, i see the query
that joins table mapped to superclass and ALL tables mapped as
subclasses, though return only infomation from one header table.
Is such behavior correct? And if I have 20 subclasses (and subtables)?
can i change this behavior somehow?
i have the following structure of entities:
@Entity
@Table(name="X.Ref")
@Inheritance(strategy=InheritanceType.JOINED)
public class Ref implements Serializable{
private Integer id;
@Id @GeneratedValue
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
private String name = "";
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
private String status = "r";
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
}
@Entity
@Table(name="X.OrgAdd")
@PrimaryKeyJoinColumn(name="Pnt")
public class Organization extends Ref {
private String address = "";
private String full_name="";
...
}
@Entity
@Table(name="X.PeopleAdd")
@PrimaryKeyJoinColumn(name="Pnt")
public class Person extends Ref {
private String sex = "";
private String addressfact="";
private String email="";
...
}
@Entity
@Table(name="X.ClientAdd")
@PrimaryKeyJoinColumn(name="Pnt")
public class Client extends Ref {
private String client_code = "";
private String depo_code="";
...
}
and several other subclasses.
I use JBOSS 4.0.5.
thanks in advance.