Lasneyx wrote:
This is my last post till monday, when I'll be able to prove this.
Thanks for answering to my topic. I don't forget to vote your replys ;) but let me say a last thing. Tell me if you're telling me to do this:
RangeRequest.hbm.xml
<hibernate-mapping>
<class name="package.to.RangeRequest" table="RANGE_REQUESTS">
<id name="codRequest" column="cod_range_request" type="int">
<generator>
...
</generator>
</id>
<property name="descRequest" column="desc_range_request" type="string"/>
<!-- more properties -->
</class>
</hiberante-mapping>
<hibernate-mapping>
<class name="package.to.IpRequest" table="IP_REQUESTS">
<id name="codRequest" column="cod_ip_request" type="int">
<generator>
...
</generator>
</id>
<property name="descRequest" column="desc_ip_request" type="string"/>
<!-- more properties -->
</class>
</hibernate-mapping>
[Note that name="codRequest" and name="descRequest" is the same in both mappings]
Will Hibernate look inside RangeRequest and its parent Request to search for getCodRequest and setCodRequest (the same for DescXXX and IpRequest)? It's not necessary to map Request class? (remember that request class doesn't have a table into my database model).
That is correct. By "extending" request, RangeRequest and IpRequest DO ACTUALLY HAVE the methods setCodRequest() and getCodRequest(). That's how inheritance works.
This of course assumes that these two methods are defined in Request.