{"id":1219,"date":"2010-07-13T18:18:21","date_gmt":"2010-07-13T12:48:21","guid":{"rendered":"https:\/\/2thenew.today\/blog\/?p=1219"},"modified":"2015-07-09T15:03:06","modified_gmt":"2015-07-09T09:33:06","slug":"grails-hibernate-filter-plugin-a-life-saver","status":"publish","type":"post","link":"https:\/\/2thenew.today\/blog\/grails-hibernate-filter-plugin-a-life-saver\/","title":{"rendered":"Grails Hibernate Filter Plugin a Life Saver"},"content":{"rendered":"<p>The project I am currently working on is also accessible from the iPhone. In the last few months so many changes have been done on the web application (developed in groovy\/grails). Now the client wants the same thing on iPhone as well. He has a separate development team for iPhone application. The <a title=\"iPhone Application Developers\" href=\"https:\/\/2thenew.today\/mobile-ios-application-development-services\">iPhone application developer<\/a> wanted to have soft delete mechanism for deleting an object. So they added new field in the database table named &#8220;deleted&#8221;.<\/p>\n<p>Now we have to remove all such records from our every query in the project which have deleted true. So there were 6-7 domains which now have this mechanism of soft deletion.<\/p>\n<p>That&#8217;s how our life became hell, we were unsure about what to do next, is it good to modify all the queries in the project which would be a lot of work.<\/p>\n<p>I was also reading Hibernate books these days and found a very good thing in Hibernate about filters. So now I just need to look for how the filters work in Grails. In few seconds I found my &#8220;life saver&#8221; plugin for Grails i.e. <a href=\"http:\/\/www.grails.org\/plugin\/hibernate-filter\">http:\/\/www.grails.org\/plugin\/hibernate-filter<\/a>. Everything is written in the plugin documentation but I would like to re-quote some of the documentation<\/p>\n<p>My class was like<\/p>\n<pre lang=\"groovy\">Class A{\r\nString name\r\nString address\r\nBoolean deleted\r\n} \r\n<\/pre>\n<p>After installing the plugin I just need to add a line in the domain and a property in datasource file and it will filter all the data with the condition that I put in filter. So my domain would become like this.<\/p>\n<pre lang=\"groovy\">Class A{\r\nString name\r\nString address\r\nBoolean deleted\r\n} \r\n\r\nstatic hibernateFilters = {\r\n        enabledFilter(condition: 'deleted=0', default: true)\r\n    }\r\n\r\n\r\n<\/pre>\n<p>in Datasource.groovy file I need to write<\/p>\n<pre lang=\"groovy\">import  org.grails.plugin.hibernate.filter.HibernateFilterDomainConfiguration\r\ndataSource {\r\n   \u2026\r\n   configClass = HibernateFilterDomainConfiguration.class\r\n}\r\n\r\n\r\n<\/pre>\n<p>and I am done without looking at how many places I have used dynamic finders or queried the database for this domain.<\/p>\n<p>I haven&#8217;t gone into the details of the plugin but it really saved a lot of work for me.<br \/>\nHope it helps<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The project I am currently working on is also accessible from the iPhone. In the last few months so many changes have been done on the web application (developed in groovy\/grails). Now the client wants the same thing on iPhone as well. He has a separate development team for iPhone application. The iPhone application developer [&hellip;]<\/p>\n","protected":false},"author":11,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":16,"footnotes":""},"categories":[7],"tags":[308,309,307],"class_list":["post-1219","post","type-post","status-publish","format-standard","hentry","category-grails","tag-filter-in-grails-domain","tag-hibernate-filter","tag-hibernate-filter-in-grails"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.0.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"The project I am currently working on is also accessible from the iPhone. In the last few months so many changes have been done on the web application (developed in groovy\/grails). Now the client wants the same thing on iPhone as well. He has a separate development team for iPhone application. The iPhone application developer\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Uday Pratap Singh\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/2thenew.today\/blog\/grails-hibernate-filter-plugin-a-life-saver\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.0.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"TO THE NEW BLOG\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Grails Hibernate Filter Plugin a Life Saver | TO THE NEW Blog\" \/>\n\t\t<meta property=\"og:description\" content=\"The project I am currently working on is also accessible from the iPhone. In the last few months so many changes have been done on the web application (developed in groovy\/grails). Now the client wants the same thing on iPhone as well. He has a separate development team for iPhone application. The iPhone application developer\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/2thenew.today\/blog\/grails-hibernate-filter-plugin-a-life-saver\/\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/2thenew.today\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/2thenew.today\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png\" \/>\n\t\t<meta property=\"article:tag\" content=\"grails\" \/>\n\t\t<meta property=\"article:tag\" content=\"filter in grails domain\" \/>\n\t\t<meta property=\"article:tag\" content=\"hibernate filter\" \/>\n\t\t<meta property=\"article:tag\" content=\"hibernate filter in grails\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2010-07-13T12:48:21+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2015-07-09T09:33:06+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:site\" content=\"@tothenew\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Grails Hibernate Filter Plugin a Life Saver | TO THE NEW Blog\" \/>\n\t\t<meta name=\"twitter:description\" content=\"The project I am currently working on is also accessible from the iPhone. In the last few months so many changes have been done on the web application (developed in groovy\/grails). Now the client wants the same thing on iPhone as well. He has a separate development team for iPhone application. The iPhone application developer\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/2thenew.today\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/grails-hibernate-filter-plugin-a-life-saver\\\/#article\",\"name\":\"Grails Hibernate Filter Plugin a Life Saver | TO THE NEW Blog\",\"headline\":\"Grails Hibernate Filter Plugin a Life Saver\",\"author\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/uday\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#organization\"},\"datePublished\":\"2010-07-13T18:18:21+05:30\",\"dateModified\":\"2015-07-09T15:03:06+05:30\",\"inLanguage\":\"en-US\",\"commentCount\":5,\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/grails-hibernate-filter-plugin-a-life-saver\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/grails-hibernate-filter-plugin-a-life-saver\\\/#webpage\"},\"articleSection\":\"Grails, filter in grails domain, hibernate filter, hibernate filter in grails\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/grails-hibernate-filter-plugin-a-life-saver\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.tothenew.com\\\/blog\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/grails\\\/#listItem\",\"name\":\"Grails\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/grails\\\/#listItem\",\"position\":2,\"name\":\"Grails\",\"item\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/grails\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/grails-hibernate-filter-plugin-a-life-saver\\\/#listItem\",\"name\":\"Grails Hibernate Filter Plugin a Life Saver\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/grails-hibernate-filter-plugin-a-life-saver\\\/#listItem\",\"position\":3,\"name\":\"Grails Hibernate Filter Plugin a Life Saver\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/grails\\\/#listItem\",\"name\":\"Grails\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#organization\",\"name\":\"TO THE NEW Blog\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/uday\\\/#author\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/uday\\\/\",\"name\":\"Uday Pratap Singh\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/grails-hibernate-filter-plugin-a-life-saver\\\/#authorImage\",\"url\":\"https:\\\/\\\/newersworld-sf-static.tothenew.net\\\/prod\\\/profilePicFolder\\\/d4c98503-ff55-4112-8fc2-e3c4fcc6fc3a_282-Uday-Pratap-Singh-PROFILEPICTURE.jpeg\",\"width\":96,\"height\":96,\"caption\":\"Uday Pratap Singh\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/grails-hibernate-filter-plugin-a-life-saver\\\/#webpage\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/grails-hibernate-filter-plugin-a-life-saver\\\/\",\"name\":\"Grails Hibernate Filter Plugin a Life Saver | TO THE NEW Blog\",\"description\":\"The project I am currently working on is also accessible from the iPhone. In the last few months so many changes have been done on the web application (developed in groovy\\\/grails). Now the client wants the same thing on iPhone as well. He has a separate development team for iPhone application. The iPhone application developer\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/grails-hibernate-filter-plugin-a-life-saver\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/uday\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/uday\\\/#author\"},\"datePublished\":\"2010-07-13T18:18:21+05:30\",\"dateModified\":\"2015-07-09T15:03:06+05:30\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/\",\"name\":\"TO THE NEW Blog\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Grails Hibernate Filter Plugin a Life Saver | TO THE NEW Blog","description":"The project I am currently working on is also accessible from the iPhone. In the last few months so many changes have been done on the web application (developed in groovy\/grails). Now the client wants the same thing on iPhone as well. He has a separate development team for iPhone application. The iPhone application developer","canonical_url":"https:\/\/2thenew.today\/blog\/grails-hibernate-filter-plugin-a-life-saver\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/2thenew.today\/blog\/grails-hibernate-filter-plugin-a-life-saver\/#article","name":"Grails Hibernate Filter Plugin a Life Saver | TO THE NEW Blog","headline":"Grails Hibernate Filter Plugin a Life Saver","author":{"@id":"https:\/\/2thenew.today\/blog\/author\/uday\/#author"},"publisher":{"@id":"https:\/\/2thenew.today\/blog\/#organization"},"datePublished":"2010-07-13T18:18:21+05:30","dateModified":"2015-07-09T15:03:06+05:30","inLanguage":"en-US","commentCount":5,"mainEntityOfPage":{"@id":"https:\/\/2thenew.today\/blog\/grails-hibernate-filter-plugin-a-life-saver\/#webpage"},"isPartOf":{"@id":"https:\/\/2thenew.today\/blog\/grails-hibernate-filter-plugin-a-life-saver\/#webpage"},"articleSection":"Grails, filter in grails domain, hibernate filter, hibernate filter in grails"},{"@type":"BreadcrumbList","@id":"https:\/\/2thenew.today\/blog\/grails-hibernate-filter-plugin-a-life-saver\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/2thenew.today\/blog#listItem","position":1,"name":"Home","item":"https:\/\/2thenew.today\/blog","nextItem":{"@type":"ListItem","@id":"https:\/\/2thenew.today\/blog\/category\/grails\/#listItem","name":"Grails"}},{"@type":"ListItem","@id":"https:\/\/2thenew.today\/blog\/category\/grails\/#listItem","position":2,"name":"Grails","item":"https:\/\/2thenew.today\/blog\/category\/grails\/","nextItem":{"@type":"ListItem","@id":"https:\/\/2thenew.today\/blog\/grails-hibernate-filter-plugin-a-life-saver\/#listItem","name":"Grails Hibernate Filter Plugin a Life Saver"},"previousItem":{"@type":"ListItem","@id":"https:\/\/2thenew.today\/blog#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/2thenew.today\/blog\/grails-hibernate-filter-plugin-a-life-saver\/#listItem","position":3,"name":"Grails Hibernate Filter Plugin a Life Saver","previousItem":{"@type":"ListItem","@id":"https:\/\/2thenew.today\/blog\/category\/grails\/#listItem","name":"Grails"}}]},{"@type":"Organization","@id":"https:\/\/2thenew.today\/blog\/#organization","name":"TO THE NEW Blog","url":"https:\/\/2thenew.today\/blog\/"},{"@type":"Person","@id":"https:\/\/2thenew.today\/blog\/author\/uday\/#author","url":"https:\/\/2thenew.today\/blog\/author\/uday\/","name":"Uday Pratap Singh","image":{"@type":"ImageObject","@id":"https:\/\/2thenew.today\/blog\/grails-hibernate-filter-plugin-a-life-saver\/#authorImage","url":"https:\/\/newersworld-sf-static.tothenew.net\/prod\/profilePicFolder\/d4c98503-ff55-4112-8fc2-e3c4fcc6fc3a_282-Uday-Pratap-Singh-PROFILEPICTURE.jpeg","width":96,"height":96,"caption":"Uday Pratap Singh"}},{"@type":"WebPage","@id":"https:\/\/2thenew.today\/blog\/grails-hibernate-filter-plugin-a-life-saver\/#webpage","url":"https:\/\/2thenew.today\/blog\/grails-hibernate-filter-plugin-a-life-saver\/","name":"Grails Hibernate Filter Plugin a Life Saver | TO THE NEW Blog","description":"The project I am currently working on is also accessible from the iPhone. In the last few months so many changes have been done on the web application (developed in groovy\/grails). Now the client wants the same thing on iPhone as well. He has a separate development team for iPhone application. The iPhone application developer","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/2thenew.today\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/2thenew.today\/blog\/grails-hibernate-filter-plugin-a-life-saver\/#breadcrumblist"},"author":{"@id":"https:\/\/2thenew.today\/blog\/author\/uday\/#author"},"creator":{"@id":"https:\/\/2thenew.today\/blog\/author\/uday\/#author"},"datePublished":"2010-07-13T18:18:21+05:30","dateModified":"2015-07-09T15:03:06+05:30"},{"@type":"WebSite","@id":"https:\/\/2thenew.today\/blog\/#website","url":"https:\/\/2thenew.today\/blog\/","name":"TO THE NEW Blog","inLanguage":"en-US","publisher":{"@id":"https:\/\/2thenew.today\/blog\/#organization"}}]},"og:locale":"en_US","og:site_name":"TO THE NEW BLOG","og:type":"article","og:title":"Grails Hibernate Filter Plugin a Life Saver | TO THE NEW Blog","og:description":"The project I am currently working on is also accessible from the iPhone. In the last few months so many changes have been done on the web application (developed in groovy\/grails). Now the client wants the same thing on iPhone as well. He has a separate development team for iPhone application. The iPhone application developer","og:url":"https:\/\/2thenew.today\/blog\/grails-hibernate-filter-plugin-a-life-saver\/","og:image":"https:\/\/2thenew.today\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png","og:image:secure_url":"https:\/\/2thenew.today\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png","article:tag":["grails","filter in grails domain","hibernate filter","hibernate filter in grails"],"article:published_time":"2010-07-13T12:48:21+00:00","article:modified_time":"2015-07-09T09:33:06+00:00","twitter:card":"summary","twitter:site":"@tothenew","twitter:title":"Grails Hibernate Filter Plugin a Life Saver | TO THE NEW Blog","twitter:description":"The project I am currently working on is also accessible from the iPhone. In the last few months so many changes have been done on the web application (developed in groovy\/grails). Now the client wants the same thing on iPhone as well. He has a separate development team for iPhone application. The iPhone application developer","twitter:image":"https:\/\/2thenew.today\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png"},"aioseo_meta_data":{"post_id":"1219","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":"","og_description":"","og_object_type":"article","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":"","og_article_tags":"","twitter_use_og":false,"twitter_card":"summary","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"limit_modified_date":false,"created":"2021-04-30 07:33:43","updated":"2024-02-29 10:05:10","focus_keyword":null,"additional_keywords":null,"truseo_locale":null,"ai":null,"breadcrumb_settings":null,"seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/2thenew.today\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/2thenew.today\/blog\/category\/grails\/\" title=\"Grails\">Grails<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tGrails Hibernate Filter Plugin a Life Saver\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/2thenew.today\/blog"},{"label":"Grails","link":"https:\/\/2thenew.today\/blog\/category\/grails\/"},{"label":"Grails Hibernate Filter Plugin a Life Saver","link":"https:\/\/2thenew.today\/blog\/grails-hibernate-filter-plugin-a-life-saver\/"}],"_links":{"self":[{"href":"https:\/\/2thenew.today\/blog\/wp-json\/wp\/v2\/posts\/1219","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/2thenew.today\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/2thenew.today\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/2thenew.today\/blog\/wp-json\/wp\/v2\/users\/11"}],"replies":[{"embeddable":true,"href":"https:\/\/2thenew.today\/blog\/wp-json\/wp\/v2\/comments?post=1219"}],"version-history":[{"count":0,"href":"https:\/\/2thenew.today\/blog\/wp-json\/wp\/v2\/posts\/1219\/revisions"}],"wp:attachment":[{"href":"https:\/\/2thenew.today\/blog\/wp-json\/wp\/v2\/media?parent=1219"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/2thenew.today\/blog\/wp-json\/wp\/v2\/categories?post=1219"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/2thenew.today\/blog\/wp-json\/wp\/v2\/tags?post=1219"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}