ieat.hbm.xml 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE hibernate-mapping
  3. PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
  4. <!--
  5. iEat Hibernate queries for MySQL
  6. -->
  7. <hibernate-mapping>
  8. <query name="BaseAll">
  9. <![CDATA[from magoffin.matt.ieat.domain.Base base order by lower(base.Value) asc]]>
  10. </query>
  11. <query name="CourseAll">
  12. <![CDATA[from magoffin.matt.ieat.domain.Course course order by lower(course.Value) asc]]>
  13. </query>
  14. <query name="DifficultyAll">
  15. <![CDATA[from magoffin.matt.ieat.domain.Difficulty difficulty order by difficulty.id asc]]>
  16. </query>
  17. <query name="EthnicityAll">
  18. <![CDATA[from magoffin.matt.ieat.domain.Ethnicity ethnicity order by lower(ethnicity.Value) asc]]>
  19. </query>
  20. <query name="IngredientAll">
  21. <![CDATA[from magoffin.matt.ieat.domain.Ingredient ingredient order by lower(ingredient.Name) asc]]>
  22. </query>
  23. <query name="MealsForUser">
  24. <![CDATA[from magoffin.matt.ieat.domain.Meal meal where meal.Owner.id = ? order by lower(meal.Name) asc]]>
  25. </query>
  26. <query name="PrepTimeAll">
  27. <![CDATA[from magoffin.matt.ieat.domain.PrepTime prep order by prep.id asc]]>
  28. </query>
  29. <query name="RecipeAll">
  30. <![CDATA[from magoffin.matt.ieat.domain.Recipe recipe order by recipe.id asc]]>
  31. </query>
  32. <query name="RecipeAllCount">
  33. <![CDATA[select count(*) from magoffin.matt.ieat.domain.Recipe]]>
  34. </query>
  35. <query name="RecipeUsedAsIngredient">
  36. <![CDATA[
  37. select rr
  38. from magoffin.matt.ieat.domain.Recipe rr,
  39. magoffin.matt.ieat.domain.RecipeIngredient ri
  40. where ri in elements(rr.Ingredient)
  41. and ri.Recipe.id = ?
  42. order by lower(rr.Name)
  43. ]]>
  44. </query>
  45. <query name="SystemAll">
  46. <![CDATA[from magoffin.matt.ieat.domain.System sys order by lower(sys.Value) asc]]>
  47. </query>
  48. <query name="UserByEmail">
  49. <![CDATA[from magoffin.matt.ieat.domain.User user where lower(user.Email) = lower(?)]]>
  50. </query>
  51. <query name="UserByLogin">
  52. <![CDATA[from magoffin.matt.ieat.domain.User user where user.Login = ?]]>
  53. </query>
  54. <query name="UsersForAccessLevel">
  55. <![CDATA[from magoffin.matt.ieat.domain.User user where user.AccessLevel >= ?]]>
  56. </query>
  57. <query name="UnitsAll">
  58. <![CDATA[from magoffin.matt.ieat.domain.Unit units order by lower(units.Value) asc]]>
  59. </query>
  60. <query name="UnitsForSystem">
  61. <![CDATA[from magoffin.matt.ieat.domain.Unit units where units.SystemId = ? or units.SystemId is null order by lower(units.Value) asc]]>
  62. </query>
  63. <!-- SQL queries below -->
  64. <sql-query name="UsersStaleRegistration">
  65. <!-- FIXME: this query is hard-coded because I couldn't find a way for MySQL to allow the interval as a ? parameter -->
  66. <return alias="users" class="magoffin.matt.ieat.domain.User"/>
  67. <![CDATA[select {users.*} from users {users} where users.createdDate < date_sub(current_date,interval 14 day) and users.accessLevel < 0]]>
  68. </sql-query>
  69. </hibernate-mapping>