I need to know which physical column is associated to a persistent’s attribute.
e.g.
Class LDocLine has this attribute
private Integer lineNumber;
which is mapped in hibernate like this :
<property name="lineNumber" column="LINENUMBER" type="integer"/>
The method I need is something like :
getColumn(“LDocLine”,”lineNumber) => “LINENUMBER”
I assume its existence internally, but not sure if it’s in the public api.
Thanks in advance
Do you have access to
Configurationobject you’ve used to build your session factory? If so, you can use the following:Column documentation.
If you don’t have access to configuration, you can obtain column data from
SessionFactoryinstance, however in this case you’re technically no longer using public API as you’ll have to class cast to internal implementations:In both cases
entityNameis the name of your entity (its class name unless explicitly overridden)