Hi all,
I am new to Hibernate.
I have a simple question i hope somebody can help me with.
I am using Spring MVC and Hibernate(great combination).
I have a mapping with three objects:
Code:
<class name="ValidationResult" table="validation_result">
<id name="validationResultId" type="long" column="validation_result_id"></id>
<property name="aiaValue" column="aia_value" />
<property name="creationDate" type="timestamp" column="creation_date" />
<property name="policyNr" column="polnr" />
<component name="validationRule" class="ValidationRule">
<property name="ruleId" column="rule_id" />
<property name="ruleVersion" column="rule_version" />
</component>
</class>
<class name="ValidationRule" table="validation_result">
<id name="ruleId" type="long" column="rule_id"></id>
<many-to-one name="validationParameter" column="parameter_id" class="ValidationParameter"
lazy="false" cascade="none" not-null="true" />
<property name="rulesetId" column="ruleset_id" />
<property name="ruleVersion" column="rule_version" />
</class>
<class name="ValidationParameter" table="validation_parameter">
<id name="parameterId" type="long" column="parameter_id"></id>
<property name="Uom" column="uom" />
</class>
I also have the three objects as POJOs in my application.
So the objects are ValidationResult, ValidationRule and ValidationParameter.
But i have only the DAO and Service layer for one object which is ValidationResult.
So what i want is to retrieve all three objects, by only querying for the ValidationResult. The mapping has the correct relations defined.
Can Hibernate do that, when the two other objects are only defined as POJOs, and in the Hibernate mapping, but they have no Service layer or DAO layer ?
I do not want to query for ValidationRule or ValidationParameter, it only makes sense when querying for ValidationResult to retrieve all three objects.
Or do i need to make a DAO and Service layer for all three objects ?
Best Regards
Cemil