{"id":19044,"date":"2015-04-17T16:05:12","date_gmt":"2015-04-17T10:35:12","guid":{"rendered":"https:\/\/2thenew.today\/blog\/?p=19044"},"modified":"2015-04-17T16:05:12","modified_gmt":"2015-04-17T10:35:12","slug":"making-a-domain-non-persistent","status":"publish","type":"post","link":"https:\/\/2thenew.today\/blog\/making-a-domain-non-persistent\/","title":{"rendered":"Making a domain non-persistent"},"content":{"rendered":"<p>In grails app, there might come scenarios where one need to create a non-persistent domain rather than creating a command obejct or POJO \/ POGO.<\/p>\n<p>GORM comes with a handy static property mapWith which has default value GORM (which associates any domain with gorm persistence layer).<br \/>\nTo make a domain non persistent set mapWith=&#8221;none&#8221;. For example, see Ticket domain below<\/p>\n<p>[code lang=&#8221;groovy&#8221;]<br \/>\npublic class Ticket {<br \/>\n    String id<br \/>\n    List&lt;Long&gt; productInstanceId<br \/>\n    static hasMany = [productInstanceId:Long]<br \/>\n    static mapWith = &quot;none&quot;<br \/>\n}<br \/>\n[\/code]<\/p>\n<p>Advantages:-<\/p>\n<ol>\n<li>Still behaves like a GORM Domain in most of the cases like Ticket domain above is still accessible by GrailsDomainClass<\/li>\n<li>When using multiple database , still respects the convention over configuration policy.<\/li>\n<li>supports scaffolding while same can&#8217;t be done for command objects. <\/li>\n<\/ol>\n<hr>\n<p>Also, at some point of time to check on a particular domain that what type of mapping it has, fetch the static property with domain class. For the domain above,  it would be <\/p>\n<p>[code lang=&#8221;groovy&#8221;]<br \/>\nTicket.mapWith<br \/>\n[\/code]<\/p>\n<p>or<\/p>\n<p>[code lang=&#8221;groovy&#8221;]<br \/>\nTicket.class.mapWith<br \/>\n[\/code]<\/p>\n<p>If doing a dynamic check then can find it with the help of DefaultGrailsDomainClass.<\/p>\n<p>[code lang=&#8221;groovy&#8221;]<br \/>\nGrailsDomainClass domainClass = new DefaultGrailsDomainClass(Ticket.class)<br \/>\ndomainClass.mappingStrategy<br \/>\n[\/code]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In grails app, there might come scenarios where one need to create a non-persistent domain rather than creating a command obejct or POJO \/ POGO. GORM comes with a handy static property mapWith which has default value GORM (which associates any domain with gorm persistence layer). To make a domain non persistent set mapWith=&#8221;none&#8221;. For [&hellip;]<\/p>\n","protected":false},"author":119,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":6,"footnotes":""},"categories":[7],"tags":[29,4840,1757,1758],"class_list":["post-19044","post","type-post","status-publish","format-standard","hentry","category-grails","tag-gorm","tag-grails","tag-mapwith","tag-non-persistent-domain"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.0.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"In grails app, there might come scenarios where one need to create a non-persistent domain rather than creating a command obejct or POJO \/ POGO. GORM comes with a handy static property mapWith which has default value GORM (which associates any domain with gorm persistence layer). To make a domain non persistent set mapWith=&quot;none&quot;. For\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Vinay Prajapati\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/2thenew.today\/blog\/making-a-domain-non-persistent\/\" \/>\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=\"blog\" \/>\n\t\t<meta property=\"og:title\" content=\"Making a domain non-persistent | TO THE NEW Blog\" \/>\n\t\t<meta property=\"og:description\" content=\"In grails app, there might come scenarios where one need to create a non-persistent domain rather than creating a command obejct or POJO \/ POGO. GORM comes with a handy static property mapWith which has default value GORM (which associates any domain with gorm persistence layer). To make a domain non persistent set mapWith=&quot;none&quot;. For\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/2thenew.today\/blog\/making-a-domain-non-persistent\/\" \/>\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 name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:site\" content=\"@tothenew\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Making a domain non-persistent | TO THE NEW Blog\" \/>\n\t\t<meta name=\"twitter:description\" content=\"In grails app, there might come scenarios where one need to create a non-persistent domain rather than creating a command obejct or POJO \/ POGO. GORM comes with a handy static property mapWith which has default value GORM (which associates any domain with gorm persistence layer). To make a domain non persistent set mapWith=&quot;none&quot;. For\" \/>\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\\\/making-a-domain-non-persistent\\\/#article\",\"name\":\"Making a domain non-persistent | TO THE NEW Blog\",\"headline\":\"Making a domain non-persistent\",\"author\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/banti-prajapati\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#organization\"},\"datePublished\":\"2015-04-17T16:05:12+05:30\",\"dateModified\":\"2015-04-17T16:05:12+05:30\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/making-a-domain-non-persistent\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/making-a-domain-non-persistent\\\/#webpage\"},\"articleSection\":\"Grails, GORM, Grails, mapWith, non persistent domain\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/making-a-domain-non-persistent\\\/#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\\\/making-a-domain-non-persistent\\\/#listItem\",\"name\":\"Making a domain non-persistent\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/making-a-domain-non-persistent\\\/#listItem\",\"position\":3,\"name\":\"Making a domain non-persistent\",\"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\\\/banti-prajapati\\\/#author\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/banti-prajapati\\\/\",\"name\":\"Vinay Prajapati\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/making-a-domain-non-persistent\\\/#authorImage\",\"url\":\"https:\\\/\\\/newersworld-sf-static.tothenew.net\\\/prod\\\/profilePicFolder\\\/1e6eb582-cd9f-416a-840d-4ea31be5ee61_vinay.prajapati@tothenew.com.jpg\",\"width\":96,\"height\":96,\"caption\":\"Vinay Prajapati\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/making-a-domain-non-persistent\\\/#webpage\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/making-a-domain-non-persistent\\\/\",\"name\":\"Making a domain non-persistent | TO THE NEW Blog\",\"description\":\"In grails app, there might come scenarios where one need to create a non-persistent domain rather than creating a command obejct or POJO \\\/ POGO. GORM comes with a handy static property mapWith which has default value GORM (which associates any domain with gorm persistence layer). To make a domain non persistent set mapWith=\\\"none\\\". For\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/making-a-domain-non-persistent\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/banti-prajapati\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/banti-prajapati\\\/#author\"},\"datePublished\":\"2015-04-17T16:05:12+05:30\",\"dateModified\":\"2015-04-17T16:05:12+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":"Making a domain non-persistent | TO THE NEW Blog","description":"In grails app, there might come scenarios where one need to create a non-persistent domain rather than creating a command obejct or POJO \/ POGO. GORM comes with a handy static property mapWith which has default value GORM (which associates any domain with gorm persistence layer). To make a domain non persistent set mapWith=\"none\". For","canonical_url":"https:\/\/2thenew.today\/blog\/making-a-domain-non-persistent\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/2thenew.today\/blog\/making-a-domain-non-persistent\/#article","name":"Making a domain non-persistent | TO THE NEW Blog","headline":"Making a domain non-persistent","author":{"@id":"https:\/\/2thenew.today\/blog\/author\/banti-prajapati\/#author"},"publisher":{"@id":"https:\/\/2thenew.today\/blog\/#organization"},"datePublished":"2015-04-17T16:05:12+05:30","dateModified":"2015-04-17T16:05:12+05:30","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/2thenew.today\/blog\/making-a-domain-non-persistent\/#webpage"},"isPartOf":{"@id":"https:\/\/2thenew.today\/blog\/making-a-domain-non-persistent\/#webpage"},"articleSection":"Grails, GORM, Grails, mapWith, non persistent domain"},{"@type":"BreadcrumbList","@id":"https:\/\/2thenew.today\/blog\/making-a-domain-non-persistent\/#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\/making-a-domain-non-persistent\/#listItem","name":"Making a domain non-persistent"},"previousItem":{"@type":"ListItem","@id":"https:\/\/2thenew.today\/blog#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/2thenew.today\/blog\/making-a-domain-non-persistent\/#listItem","position":3,"name":"Making a domain non-persistent","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\/banti-prajapati\/#author","url":"https:\/\/2thenew.today\/blog\/author\/banti-prajapati\/","name":"Vinay Prajapati","image":{"@type":"ImageObject","@id":"https:\/\/2thenew.today\/blog\/making-a-domain-non-persistent\/#authorImage","url":"https:\/\/newersworld-sf-static.tothenew.net\/prod\/profilePicFolder\/1e6eb582-cd9f-416a-840d-4ea31be5ee61_vinay.prajapati@tothenew.com.jpg","width":96,"height":96,"caption":"Vinay Prajapati"}},{"@type":"WebPage","@id":"https:\/\/2thenew.today\/blog\/making-a-domain-non-persistent\/#webpage","url":"https:\/\/2thenew.today\/blog\/making-a-domain-non-persistent\/","name":"Making a domain non-persistent | TO THE NEW Blog","description":"In grails app, there might come scenarios where one need to create a non-persistent domain rather than creating a command obejct or POJO \/ POGO. GORM comes with a handy static property mapWith which has default value GORM (which associates any domain with gorm persistence layer). To make a domain non persistent set mapWith=\"none\". For","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/2thenew.today\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/2thenew.today\/blog\/making-a-domain-non-persistent\/#breadcrumblist"},"author":{"@id":"https:\/\/2thenew.today\/blog\/author\/banti-prajapati\/#author"},"creator":{"@id":"https:\/\/2thenew.today\/blog\/author\/banti-prajapati\/#author"},"datePublished":"2015-04-17T16:05:12+05:30","dateModified":"2015-04-17T16:05:12+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":"blog","og:title":"Making a domain non-persistent | TO THE NEW Blog","og:description":"In grails app, there might come scenarios where one need to create a non-persistent domain rather than creating a command obejct or POJO \/ POGO. GORM comes with a handy static property mapWith which has default value GORM (which associates any domain with gorm persistence layer). To make a domain non persistent set mapWith=&quot;none&quot;. For","og:url":"https:\/\/2thenew.today\/blog\/making-a-domain-non-persistent\/","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","twitter:card":"summary","twitter:site":"@tothenew","twitter:title":"Making a domain non-persistent | TO THE NEW Blog","twitter:description":"In grails app, there might come scenarios where one need to create a non-persistent domain rather than creating a command obejct or POJO \/ POGO. GORM comes with a handy static property mapWith which has default value GORM (which associates any domain with gorm persistence layer). To make a domain non persistent set mapWith=&quot;none&quot;. For","twitter:image":"https:\/\/2thenew.today\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png"},"aioseo_meta_data":{"post_id":"19044","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","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":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","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:35:13","updated":"2024-02-29 08:21:41","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\tMaking a domain non-persistent\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":"Making a domain non-persistent","link":"https:\/\/2thenew.today\/blog\/making-a-domain-non-persistent\/"}],"_links":{"self":[{"href":"https:\/\/2thenew.today\/blog\/wp-json\/wp\/v2\/posts\/19044","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\/119"}],"replies":[{"embeddable":true,"href":"https:\/\/2thenew.today\/blog\/wp-json\/wp\/v2\/comments?post=19044"}],"version-history":[{"count":0,"href":"https:\/\/2thenew.today\/blog\/wp-json\/wp\/v2\/posts\/19044\/revisions"}],"wp:attachment":[{"href":"https:\/\/2thenew.today\/blog\/wp-json\/wp\/v2\/media?parent=19044"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/2thenew.today\/blog\/wp-json\/wp\/v2\/categories?post=19044"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/2thenew.today\/blog\/wp-json\/wp\/v2\/tags?post=19044"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}