there is no relationship between table1 and table4, maybe i expressed my problem not exactly enough.
table4 in db
+id
+lastModifiedBy
+field1
+field2
+field3
hibernate has generated a mapping like:
<class name"Table4" table=table4" schema="someSchema">
<id name="id" type=long">
<column name="id" precision="12" scale="0" />
<generator class="assigned" />
</id>
<property name="lastModifiedBy" type="String">
<column name="lastModifiedBy" length="20" />
</property>
<property name="field1String" type="String">
<column name="field1" length="20" />
</property>
<property name="field2String" type="String">
<column name="field2" length="20" />
</property>
<property name="field3String" type="String">
<column name="field3" length="20" />
</property>
my java classes:
Code:
public class Entity{
protected long id;
public long getId(){
return id;
}
public void setId(long id){
this.id=id;
}
}
public class Modifiable extends Entity{
protected String lastModifiedBy;
public String getLastModifiedBy(){
return this.lastModifiedBy;
}
public void setLastModifiedBy(String lastModifiedBy){
this.lastModifiedBy=lastModifiedBy;
}
}
public class Table4 extends Modifiable {
private String field1String;
private String field2String;
private String field3String;
public String getField1String() {
return field1String;
}
public void setField1String(String field1String) {
this.field1String = field1String;
}
public String getField2String() {
return field2String;
}
public void setField2String(String field2String) {
this.field2String = field2String;
}
public String getField3String() {
return field3String;
}
public void setField3String(String field3String) {
this.field3String = field3String;
}
}
i hope that it is now more clearly. where do i have to tell(and how) hibernate the subclass mapping, so that i can make an example search. like i have described before:
Quote:
Table4 example = new Table4();
example.setLastModifiedBy("someone");
List<Table4> result = session.createCriteria(Table4.class).add(Example.create(example) .ignoreCase().list();