ieat.hbm.xml 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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. <hibernate-mapping>
  5. <query name="BaseAll">
  6. <![CDATA[from magoffin.matt.ieat.domain.Base base order by lower(base.Value) asc]]>
  7. </query>
  8. <query name="CourseAll">
  9. <![CDATA[from magoffin.matt.ieat.domain.Course course order by lower(course.Value) asc]]>
  10. </query>
  11. <query name="DifficultyAll">
  12. <![CDATA[from magoffin.matt.ieat.domain.Difficulty difficulty order by difficulty.id asc]]>
  13. </query>
  14. <query name="EthnicityAll">
  15. <![CDATA[from magoffin.matt.ieat.domain.Ethnicity ethnicity order by lower(ethnicity.Value) asc]]>
  16. </query>
  17. <query name="IngredientAll">
  18. <![CDATA[from magoffin.matt.ieat.domain.Ingredient ingredient order by lower(ingredient.Name) asc]]>
  19. </query>
  20. <query name="MealsForUser">
  21. <![CDATA[from magoffin.matt.ieat.domain.Meal meal where meal.Owner.id = ? order by lower(meal.Name) asc]]>
  22. </query>
  23. <query name="PrepTimeAll">
  24. <![CDATA[from magoffin.matt.ieat.domain.PrepTime prep order by prep.id asc]]>
  25. </query>
  26. <query name="RecipeAll">
  27. <![CDATA[from magoffin.matt.ieat.domain.Recipe recipe order by recipe.id asc]]>
  28. </query>
  29. <query name="RecipeAllCount">
  30. <![CDATA[select count(*) from magoffin.matt.ieat.domain.Recipe]]>
  31. </query>
  32. <query name="RecipeUsedAsIngredient">
  33. <![CDATA[
  34. select rr
  35. from magoffin.matt.ieat.domain.Recipe rr,
  36. magoffin.matt.ieat.domain.RecipeIngredient ri
  37. where ri in elements(rr.Ingredient)
  38. and ri.Recipe.id = ?
  39. order by lower(rr.Name)
  40. ]]>
  41. </query>
  42. <query name="SystemAll">
  43. <![CDATA[from magoffin.matt.ieat.domain.System sys order by lower(sys.Value) asc]]>
  44. </query>
  45. <query name="UserByEmail">
  46. <![CDATA[from magoffin.matt.ieat.domain.User user where lower(user.Email) = lower(?)]]>
  47. </query>
  48. <query name="UserByLogin">
  49. <![CDATA[from magoffin.matt.ieat.domain.User user where user.Login = ?]]>
  50. </query>
  51. <query name="UsersForAccessLevel">
  52. <![CDATA[from magoffin.matt.ieat.domain.User user where user.AccessLevel >= ?]]>
  53. </query>
  54. <query name="UnitsAll">
  55. <![CDATA[from magoffin.matt.ieat.domain.Unit units order by lower(units.Value) asc]]>
  56. </query>
  57. <query name="UnitsForSystem">
  58. <![CDATA[from magoffin.matt.ieat.domain.Unit units where units.SystemId = ? or units.SystemId is null order by lower(units.Value) asc]]>
  59. </query>
  60. <!-- SQL queries below -->
  61. <sql-query name="UsersStaleRegistration">
  62. <return alias="users" class="magoffin.matt.ieat.domain.User"/>
  63. <![CDATA[select {users.*} from users {users}
  64. where DATE(users.createdDate) < DATE({fn TIMESTAMPADD(SQL_TSI_DAY, -14, CURRENT_DATE)})
  65. and users.accessLevel < 0]]>
  66. </sql-query>
  67. </hibernate-mapping>