Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Specifying greater than/less than in Hibernate filters

 
craig hollinshead
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can greater than or less than symbols be added to the condition on a Hibernate filter specified in the hbm.xml file?

I am trying to add a filter to limit the collection to a specific date range:

<filter name="limitTalksByDateRange" condition="talkstart >= :tstart and talkstart <= :tend" />

Unfortunately this breaks the XML parsing. I've tried backslash-escaping, "ge" and "le" and even "between :tstart and "tend" which is mentioned in the Hibernate documentation. None has worked.
 
craig hollinshead
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Using the ASCII escape codes (&#62; for greater than, &#60; for less than) will fix the XML incompatibility with the greater/less than signs in the filter:

<filter name="limitCategoryTalksByDaterange" condition="talkstart &#62;= :tstart and talkstart &#60;= :tend" />
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic