Hello,
The use case is as follows: the user can create a search profile (what fields to display for a particular object, what search conditions should be applied, and more later), and this profile is persisted to the database in an XML string (NOT an XML object). POJO mode is not used, I only use dynamic-map and dom4j modes.
Of course, when it is retrieved from the database, I need to turn that XML into something understandable by Hibernate. I have two choices: HQL and DetachedCriteria.
I quite like the DetachedCriteria idea, but there's a challenge: XML is text. If I have, say:
Code:
<eq field="somefield" value="somevalue"/>
I need to get the type of "somefield" (this I know how to do), but also to convert the "somevalue" from a String, which it will be, to the appropriate object type. The Type API, as far as I can see, has no method to take a String as an argument and turn it into the expected class. I'm also pretty sure that Hibernate has the means to do that, and I don't want to reinvent the wheel. Where does Hibernate do it, and how?
HQL is a valid alternative, of course, but I'd prefer if I could do this with the DetachedCriteria.