Hi guys!
I'm new to Hibernate, I'm composing some HQl dynamically and I need to find the corresponding mapping of TABLE_NAME and COLUMN_NAME to objectType and propertyName at runtime.
To be clearer, let's exemplify with an excerpt from one of the Hibernate mapping files:
Code:
.......................
<hibernate-mapping>
<class table="PACKAGES" lazy="false" schema="HSTANCIU" name="com.esi.packages.model.Package">
<id name="id" column="PACKAGE_SK">
<!-- @todo: change the generator with sequence -->
<generator class="increment"/>
</id>
<timestamp column="last_update_dttm" unsaved-value="null" name="lastUpdateDTTM"/>
<property name="code" column="package_code"/>
<property name="name" column="package_name"/>
.............
</hibernate-mapping>
So, I know at runtime
TABLE_NAME = "PACKAGES"
and
COLUMN_NAME ="package_name"
I need to find the type and property name associated with this mapping. In my case this would be
"com.esi.packages.model.Package"
respective
"name"
Thank you for any idea.
Regards,
Horatiu