Fork me on GitHub

29 Jun 2010

Acyclic relationship validation in Grails

A common domain class use-case is for a self-referential relationship that must not be circular (a directed acyclic graph). For example, a Person class may have a parent property that is a many-to-one relationship with another Person instance. However a given Person cannot be his own parent or ancestor.

We're using just such a relationship for trees of pages that inherit certain characteristics from their ancestors. In order to validate that our users aren't setting up circular references I implemented the following constraint:Then I just needed to register my new constraint by adding ConstrainedProperty.registerNewConstraint(AcyclicConstraint.NAME, AcyclicConstraint) to grails-app/conf/spring/resources.groovy. Using the constraint is as simple as this:
class Person {

    String name
    Person parent

    static constraints = {
        parent acyclic: true
    }
}
The constraint can be mixed with others such as nullable: true. The really nice thing is that the constraint implementation doesn't reference any of my domain classes directly, meaning it can be re-used in any other domain class.

When you're using similar validation logic in multiple classes defining a constraint like this is a much better option than using a validator closure and like many things in Grails it turns out to be pretty easy to implement.

79 comments:

johnrellis said...

awesome! this constraint should definitely be added to the grails source, i reckon it is one that is enforced in all wacky ways in other projects. Adding a constraint looks nice and easy!

dustmite said...

Nice work! Custom constraints in Grails are very powerful. Wonder if this could be extended to look beyond direct relationship and make sure that someone isn't say their own great great grand child or such.

Rob said...

@dustmite it's already doing that

dustmite said...

@Rob Sorry, I noticed that after posting my comment. Really great stuff, took it for a spin last night and works like a charm.

As @johnrellis said this should be included with the Grails source.

Rick Jensen said...

Please, as others have said, get this included in Grails core. It's a sufficiently complex validation that is easy to mess up and is also very common.

Unknown said...

Jadwal Bola | Permainan Bola | Judi Bola | Taruhan Bola | Agen Bola | Agen Sbobet | Jasa SEO Profesional | Jasa SEO | Harga Jasa SEO Profesional | Jasa SEO Murah | Pakar SEO

Anonymous said...

338a | agen bola | agen sbobet | bola tangkas | casino sbobet | liga champion | prediksi bola | cool mobile gagdet

Anonymous said...

sbobet | ibcbet | agen bola | agen bola Terpercaya | Jasa SEO Profesional | Jasa SEO | Harga Jasa SEO Profesional | Jasa SEO Murah | Pakar SEO

Metamorfosis said...

Pelatihan SDM is network marketing and training information or training an employee who has worked with many consulting firms and training institutions.
pelatihan hrd,
pelatihan pengembangan diri,
pendidikan dan pelatihan sdm,
pelatihan akuntansi keuangan,
pelatihan sales marketing,
pelatihan kehumasan,
pelatihan sdm jogja,
lembaga pelatihan sdm
pelatihan manajemen bisnis,
pelatihan administrasi perkantoran,
lembaga training motivasi,
pelatihan sekretaris,
pelatihan karyawan,
lembaga training di jogja,
pelatihan in house training,
pelatihan public training,
jasa konsultan,
pelatihan pengembangan sdm,
pelatihan manajemen sdm,
program training karyawan,
diklat sdm,
pelatihan sdm untuk rumah sakit,
_____
id card murah,
harga id card,
cetak kartu santri,
produksi id card,
bikin id card,
cetak id card jogja,
id card murah jogja,
cetak id card,
percetakan id card,
pabrik id card,
cetak member card,
cetak kartu pelajar,
cetak kartu siswa,

Jasa Angkutan Container said...

I like your stuff, classic right, Now... everything with digital, perdita di peso thanks for remind me for this memories
water heater gainsborough
water heater ariston
water heater rinnai
water heater delizia
water heater wika

abo-bder said...


شركة شحن عفش من الرياض الي الامارات-دبي
شركة نقل اثاث من الرياض الى الامارات

شركة نقل اثاث من الرياض الى الامارات


Assignment Help said...

I loved the article, keep updating interesting articles.and we serve best food according to our customers' reviews we have a specious hall for marriages & special arrangement for kitty parties and other parties. You can visit us at any time we would love to serve you.

assignment help
assignment help
online assignment help
assignment help online
assignment help australia
do my assignment
college assignment help
university assignment help
statistics assignment help
finance assignment help

Assignment Help said...


Many of the people are depressed about the problems of essay writing. Well, don’t worry about that because we are providing this service at a very reasonable price.

Statistics Assignment Help
Statistics Homework Help
statistics help
statistics homework
statistics homework helper
SPSS Help
SPSS Tutors
SPSS Homework Help
matlab homework help
matlab assignment help
help with matlab
stata homework help
probability assignment
probability assignment help
R Programming homework help
Bio Statistics Assignment Help
R Programming Help
R Programming homework help
business statistics assignment help
business statistics homework help

Assignment Help said...

I loved the article, keep updating interesting articles.and we serve best food according to our customers' reviews we have a specious hall for marriages & special arrangement for kitty parties and other parties. You can visit us at any time we would love to serve you.

Article Assignment Help
Essay Assignment Helper
Essay writing
Essay writing service
Dissertation help
Thesis writing help
Write My Essay
Do My Essay
Hire Cheap Essay Writer
College Essay Help

Assignment Help said...

I love the article keep updating article. And we serve best food according to our customer’s review we have a specious hall for marriage & special arrangement for kitty parties and other parties. You can visit us at any time we would love to serve you.
" Essay writing
"
Essay Writer
seo writing service
Essay writing service
Essay writing help
Write My Essay
hire seo writer
hire writer
Write my essay cheap
hire article writer

Hailie Hills said...

At what type of exam questions I need to pay attention more? I'm sure that at least once every student asks him/herself this question. I can recommend you to pay attention to the facts, people names, differences, and similarities. Those things will help you to recover information which you prepared before.

Rebeca Thomson said...

Hello, thanks for this interesting article. I appreciate it a lot. Luckily I did my paper, with the help of this source https://essayelites.com/buy-a-capstone-project-online and now I can have some free time by reading this amazing blog post.

Alley John said...



Are you students and do not know How to write an assignment
? So do not worry about writing a good assignment because MyAssignmentHelp is providing the best assignment writing expert's for students.

acmarket said...




Thankyou for the valuable information.iam very interested with this one.
looking forward for more like this.

https://www.advnt01.com/5-ways-to-build-enterprise-mobile-apps-the-right-way/
https://www.asmallcinema.org/do-you-need-to-know-everything-about-hybrid-app-development/

https://www.cfecgc-unsa-ft-orange.org/top-6-mistakes-app-entrepreneurs-make-during-app-development-and-marketing/
https://www.theliyakebedefoundation.org/fun-and-practical-tablet-apps-for-seniors/
https://www.capriles.tv/not-all-apps-are-created-equal/






Marriot Roy said...



Connect with UAE VAT Expert for get best vat software in uae for vat return filing from professional expert’s at affordable price.

Becker said...

Ignouproject offer the guide books and project to the learners of the university students. Our website help those students who are working and don't have time to write their Ignou project. To help these learners we have project writing experts who write plagiarism free project which is totally customized according to the students.

meldaresearch said...

We assure you that all the best essay writers online, custom college papers, research papers and term papers that we deliver to our clients are the best in the industry and you do not need to have a second thought when buying any of our cheap paper writing service from us.

ireland assignment help said...

I read this blog post and this is a really good post, so thanks a lot for sharing this good blog post, I hope to keep more post for sharing. thanks once again. assignment writer

James Wright said...

The writing experts will help the students to compose the dissertations. If you are currently looking an online dissertation help service for writing a master's dissertation proposal that can make the process of writing and submission easier, then consider working with MyAssignmentHelp - the no.1 academic writing help portal in Malaysia.

Keith Morris said...

I am a freelancer and have been helping a lot of students in providing assistance to students who frequently gets worried about their assessment tasks and went online to search for australia assignment help terms. We at My Assignment Services have potentially recognised the need way back and started what we are an enlarged version of then. With many assignment helper companies in the market, no one has quite able to match the standard that we follow. We give utmost priority to students by strictly adhering to the assignment requirements as well as marking rubrics to score high grades. Our Assignment uk assignment help writers are well-proficient in not only comprehending your assessment tasks but also to give an expertise finish to it. Provided a well-written assignment suitable to your needs, your search for professional essay writers will now end with My Assignment Services. You just have to visit our website for more information.

Hendy said...

I read the article, this is awesome. Keep updating interesting articles. I am offering assignment help to students over the globe at very affordable prices.
statistics assignment help
econommics assignment help
finance assignment help

seo company said...

Fast Social Follower will help you increase your visiliblty on social media platform such as Buy Spotify Followers

Ideal Assignment Help said...

We are skilled at giving Engineering Assignment Help So whether you require a paper on concurrent, spread and parallel system or an amazing response for gathering the handiness, execution, cost-viability, Ideal Assignment Help is the pro community you are scanning for.

khalsa store said...

Just wanted to convey my regards. This was really a valuable experience. I will ensure that my friends also read this as soon as possible. I cannot wait to share this.

bhangra items
bhangra
artificial jewllery
jewllery
gidha
jago items
parandi
phulkari
shamiz
under shirts
naale
jura rumal
chola kids
jura rumal
kalire
churra
sehra
kalgi
garvi
rumal
surmedani
glass
sahe chitti
milani har
thelli
ribbon plate
harr
brass utensils
decoration items
1984
turbans
turban
kirpan
sikh accessories

tom554 said...

I found this is an informative blog and also very useful and knowledgeable. I would like to thank you for the efforts you have made in writing this blog.
Assignment writing

lee brown said...

My Assignment Help online helps students to achieve their goals of getting high grades in Electronics Engineering through our competent electronics engineering assignment help service. We have the pool of most expert and experienced writers, proofreaders and editors to offer 100% genuine work to our clients. If you want the same, you can contact us anytime and can discuss your assignment related issues with our writers to get desired outcome.

get assignment help online said...


Are you looking for the best assignment help service provider than visit assignment-writing-service this is the best and cheapest service provider ever.They provide all subject services according to your requirement.

please visit
mathematics-assignment-help
law-assignment-help
biology-assignment-help
machine-learning-assignment-help

John Rock said...

Your blog is charming. I want to say; please keep it. Thank You!
Assignment Help Australia
Assignment Help
Education Assignments

mehmet said...

Güzel bilgiler paylaşmışsınız emeklerinize sağlık teşekkür ederim.

chat

chat

chat odaları

sohbet sitesi

chat odası

chat sohbet

chat odası

chat arkadaşlık

assignmentworkhelp.com said...

Assignment help that ensures that you meet the deadline every time. It is important that the assignments are written in a way that all the questions asked by your professor are answered and all the objectives are fulfilled. Our subject experts make sure that we do not deviate from the actual context of the assignment and provide the best possible solution without charging an exorbitant amount. Our fair pricing and discounts make our services even more accessible and the best choice when availing the online assignment help in Australia. We consider it a sign of discipline to meet the deadline and submit top quality work within the designated time limit. The subject experts at assignment work help deliver the required output to meet the expectations of our clients every time and make sure that you get good marks for every assignment.
best online assignment writing help
assignment solution australia
best assignment help australia
online assignment help
best assignment help
assignment help in usa
online assignment website

Monnika Jacob said...

How can we stop loops and call for parameters? Is it possible to end loops before call to parameters? I am looking for the answer of this question. Please guide me. Essay writing service

Veronica Kate said...

Extremely well written paper, however a few more points can be added to make it all the more resourceful. Visit livewebtutors and make most of the valuable Vancouver Referencing Generator as offered by the best in the business. Feel free to get in touch at any point of the day.

Getassignmenthelp said...

Are you facing problem while drafting your academic paper then i will suggest please click here
Assignment Help
Law Assignment Help
Java Assignment Help
Mathematics Assignment Help
Finance Assignment Help
Essay Help
Homework Assignment Help
Account Assignment Help

umair said...

Nero Video 2020: The video editing program offers you full creativity with the easiest handling and best results for your film projects. Create perfect movies and slideshows with 1-Click Video Story. With the new Nero LifeThemes PRO you automatically create authentic moods. Nero Platinium Suite Crack 2020

Nancy Brown said...

Sometimes happens that, if someone tags you with any suspicious or fraudulent activity, then there are chances that you become locked out of your account. Sometimes also happened that your account hacked by any third party. So, to overcome this scenario, you need to unlock Facebook account.

William smith said...

Best nursing task writing help is only a tick away. On the off chance that you require a quality paper, you need to enlist an expert who is knowledgeable about the zone of your subject. My Assignment Help is the best assignment help service provider offering 100% customer satisfaction. With the help of an expert nursing writer, you can compose the best quality and unique nursing task. Avail Best Nursing Assignment Help for Students to Score High Marks.

Stringer Bell said...

Looking for engineering assignment help uk at Affordable Prices only at Assignment Studio. Get 24/7 Live Chat Support.

William smith said...

Not many students have the required knowledge and understanding of the writing task which makes it difficult for them to have their writing task covered as per the given specifications. So, connecting with My Assignment Help online Data Analytics Assignment Help writers will help you come out of trouble.

Amelia Taylor said...

Amazing post and Keep Sharing
https://prob.hostpartner.lt/smartblog/1/lorem-ipsum-dolor-sit-amet.html
https://www.dungeoncrawlers.com/smf/index.php?topic=2478.0
http://newdigital-world.com/members/ameliataylor0305.html
https://muddyhighheels.com/forum/memberlist.php?mode=viewprofile&u=17699
https://forum.singaporeexpats.com/memberlist.php?mode=viewprofile&u=287211
https://images.google.sr/url?q=https://www.abirateroneacetatecost.com/zytiga-abiraterona-acetato-precio-colombia
http://forum.hnkvz.hr/member.php?u=8562
http://forums.dollymarket.net/member.php?action=profile&uid=4248522
https://musicianfinder.com/profiles/ameliataylor0305/
http://www.musketeermadness.com/board/memberlist.php?mode=viewprofile&u=7676

Jonny Sin said...

iMazing Crack Excellent piece of work, and I am in wonder how you manage all of these content and his entry. I would like to say you have superb capabilities related to your work, and lastly, please keep it up because I am looking for the more.

Pc Full Crack said...

CadSoft EAGLE Pro Crack
VueScan Pro Crack
Origin Pro Crack
Roon Labs Crack
BeerSmith Crack

kinglalisah said...

This is an informative article content and, Got a lot of info and details from here tryst me i am never seen on my life like this topic blog. Thank you for sharing this and looking forward to reading more of your post. You are the best on this topic content writing. Assignment Help - Assignment Help Adelaide - Assignment Help Australia - Assignment Help Brisbane

My Assignment Help Online said...

Awesome blog and I love it. Please post some related blogs because I am learning much more from your article. I am here to read your article and promote myassignmenthelp connects you with professional writers so you can get requisite help for your submission.

Brooklyn Smith said...

I agree with what you are sharing your many blogs. It is important to form a consensus, and I think it is good enough to influence my next article. In the next release, I will try to post related to this topic, If you have time, please contact me, I am waiting your msg. Thanks and have a nice day dear friend. Online statistics homework help - Online college homework help - Online assignment writing service - Online physics homework help

Daily Word said...

It's really nice and meaningful. You have really helped lots of people who visit this blog and provide them useful information. See also: Best Good Morning Messages

Daily Word said...

You have quality content in your blog, I appreciate it, and I'll always come around for new updates. Checkout Nigeria Visa-Free Countries in Europe

Goodtime said...

Thanks for sharing this useful and interesting information, checkout this cut off mark for accounting in bsu it can be useful to you. Keep on sending in more useful and amazing information on your blog

bilyhank said...

Do not feel stressed as you feed your reliable knowledge in your subject field and I have got little bit idea how to address technical flaws. The proposal of Assignment Helper USA is authentic to reduce your work load.

jerry said...

National number one men's singles player Lee Zii Jia's campaign at the Indonesia Masters came to an abrupt end when he withdrew from the first round due to a back injury. The 23-year-old, who was allowed to play in the BWF World Tour Super 750, decided to pull out as he trailed 9-11 against Denmark's Rasmus Gemke in the opening round match at the Bali International Convention Center in Nusa Dua. Read this complete news at The Malaysia Post.

shiradisuza said...

After study a few of the content on your own website now, and i also truly as if your strategy for blogging. I bookmarked it to my bookmark site list and you will be checking back soon. Pls look into my internet site as well and told me what you think.

do my assignment|
paper help|
resume writing services|
english homework help|

Maxsmith said...

Thanks for posting this unmatchable quality of article. Do you guys want to produce the unmatchable quality assignment? If yes then hire essay typerfrom SourceEssay.

Gammi said...

Your article is very informative and helpful to me. Thank you for the post, it’s really nice. This is more good! Visit my site. mfa degree program application

Leo Oliver said...

Quite a fantastic article! Thank you for offering such a wide variety of services. Help with your job is available seven days a week, at any hour of the day or night. Visit now:- My Assignment Help

Leo Oliver said...


When you contact us, experts can help you complete your assignment as quickly and easily as needed. They are available to assist students with their assignments at all the time. They are masters with a lot of expertise and understanding. Students can get the greatest possible grade in their studies and complete their work with the assistance of subject experts. Visit now :- Online Assignment Help

Anonymous said...

カジノシークレット / Casino Secret の無料ボーナス、入出金 - カジノ日本

Leo Oliver said...

Our professional writers are highly skilled and qualified experts that excel in terms of performance and efficiency. If you are having difficulty completing a childcare assignment for a variety of purposes, you should seek professional help in Childcare Assignment as quickly as practical. Visit now:- Childcare Assignment Help

Assignment Experts said...

Online Assignment help Vancouver

Leo Oliver said...


Academics who want assistance with statistics assignments could seek instantly straightaway. Statistics Assignment Help is the most beneficial assistance that any student can have. For every statistics student, they establish the integrated solution. They will undoubtedly be satisfied once they have obtained their solution.

Assignment Help Online said...

If you are working as a nurse and studying too to increase your qualifications, let give us chance to help with nursing assignment while you save time for studying your courses. Global Assignment Expert is in the academic writing industry for a long time and since then is a loyal partner of the students who are burdened with writing their assignments especially nursing case study assignment. We have thousands of satisfied students who come back to us whenever they need help with their each and every assignment writing.

Studytonight said...

Hi there, thank you for sharing such great informative post with us. It is really helpful.
startup folder not working
Discord fatal JavaScript error
DX11 feature level 10.0
Learn SQL in 2022

Essien said...

You've really inspire me and I'm glad for having access to this particular site today Wonderful! Inspiring effort and write-up. Thank you for sharing. Also visit download free nigerian airforce past questions at www prep ng

faizaashraf said...

The students sometimes face financial constraints in these research paper writing expensive experiments that can reduce the quality of the assignments. So ,do not worry… our homework services provider consistently remains engaged in experiment activities for providing the quality homework service to you.

Gamers arena said...

an 1 | will hero mod apk | infinite flight flight simulator mod apk

Janet R. Mack said...

Acyclic relationships are relationships where the participants have no reason to believe that they will not be able to find a partner in the future. These relationships are usually characterized by a lack of commitment and intimacy. In this article, we will explore how Grails can help us validate our acyclic relationship with our domain object. Most students are drawn to this kind of information, but they are unable to prepare for their exams, If you have been struggling with your exams and want assistance,pay to get exam help online is dedicated to helping students get higher grades on their examinations by providing them with the best available resources, including quality academic services.

Start My Online Class said...

The acyclic relationship validation plugin might seem like a simple plugin, but it has a lot of power. It is important to understand the benefits and limitations of this plugin before you use it in your Grails application. Acyclic relationship validation helps you build relationships between different entities by validating that they are not related to one another. Most students are drawn to these types of articles and information, but they are unable to prepare for their exams, If you have been struggling with your exams and want assistance, students can hire test takers for online classes and get higher grades on their examinations by providing them with the best available resources, including quality academic services.

Hazel D. Charest said...

Grails is a powerful web application framework that allows developers to quickly create web applications. It also provides an efficient way to validate acyclic relationships in the application. Acyclic relationship validation is important when dealing with data models that have multiple relationships between entities. This ensures that the data model remains consistent and prevents data integrity issues from occurring. With Grails, developers can easily validate acyclic relationships using its built-in validation APIs. This makes it easier for them to ensure data integrity and maintain the consistency of their applications. Most students are drawn to these types of articles and information, but they are unable to prepare for their exams, If you have been struggling with your exams and want assistance, students can hire pay someone to do my online exam and get higher grades on their examinations by providing them with the best available resources, including quality academic services.

sam said...
This comment has been removed by the author.
sam said...
This comment has been removed by the author.
Janet R. Mack said...

When using online exam help, one crucial aspect is ensuring the validity and accuracy of the relationships within the system. In the case of Grails, a popular web application framework, acyclic relationship validation plays a vital role in maintaining data integrity.
Acyclic relationship validation refers to verifying that there are no cyclic dependencies or circular references between entities or objects in a database. This is particularly important in scenarios where multiple entities are interconnected and rely on each other for data retrieval and manipulation.

Carmelia B. Wood said...

One common use case for acyclic relationship validation is in take my online class for me management systems. These systems often have complex relationships between students, classes, assignments, and grades. Ensuring that these relationships are acyclic is crucial for maintaining accurate records and preventing any potential conflicts or inconsistencies.

By implementing acyclic relationship validation in Grails, you can rest assured that your online class system will operate smoothly and efficiently. This validation process will help maintain the integrity of your data model while providing a seamless user experience for both students and instructors.

Global Assignment Expert said...

If you need cheap online assignment help? Then Global Assignment Help offers the most affordable services with top-quality assignment help in all over the world. Our superior quality and 24*7 Expert assistance is very helpful to the students. Our native skilled experts cover various assignments like management assignment help, computer network assignment Help, programming assignment Help, engineering assignment help, and many more.

theresafking said...

Grails is an incredible technology that offers the best global assignment help UK students could ask for. With its advanced features and capabilities, Grails takes self-referential relationships in directed graphs and tree trees to a new level. Using cyclic relationship validation ensures that circular references are prevented, resulting in enhanced efficiency and flexibility. This means that developers can confidently build complex applications without worrying about the potential pitfalls of circular references. Grails truly empower developers to create innovative solutions while maintaining the integrity of their data structures. For students seeking reliable assignment help in the UK, Grails is the way to go.

Daniel Carl said...

Determining the best digital marketing agency in the USA can be subjective, as it depends on specific needs and objectives. However, several agencies stand out for their exceptional services. WebFX, based in Pennsylvania, offers a wide range of digital marketing solutions and a proven track record. Ignite Visibility in San Diego is known for its expertise in SEO, social media, and content marketing. Another top choice is Blue Fountain Media in New York City, which excels in website design and development, e-commerce, and online marketing. These agencies consistently deliver outstanding results and tailor strategies to meet diverse client goals, making them some of the best in the country.

ITIO Innovex said...

Get ready to embark on a lucrative journey by deciding to start your own payment gateway business . Comprehensive solutions offered by ITIO Innovex provide the tools and support needed to establish a successful venture.