History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: GRAILS-994
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Critical Critical
Assignee: Sergey Nebolsin
Reporter: Marc Palmer
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Grails

Default non-nullable constraint on relationships not enforced

Created: 28/Mar/07 04:38 PM   Updated: 13/Apr/07 03:48 PM
Component/s: Persistence
Affects Version/s: 0.5-RC1
Fix Version/s: 0.5-RC1

Time Tracking:
Not Specified

Issue Links:
dependent
 


 Description  « Hide
Take a domain class:

class ArtistMonitor {
static belongsTo = UserProfile

UserProfile userProfile
Artist artist
}

If you do new ArtistMonitor().save() you get no errors, even though there are missing references. All columns default to nullable: false and optional: false apparently, so why is this happening?

Also, and with more complexity, you get no errors when saving the class that references this i.e:

def u = new UserProfile( ...)
u.addArtistMonitor(new ArtistMonitor())
u.save()

No errors at all occur. If you save the monitor first explicitly, still no errors exist on the artistMonitor instance.

Related to GRAILS-890 possibly.



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Sergey Nebolsin - 28/Mar/07 11:53 PM
We've talked about it with Graeme and he said that associations had been made nullable by default as a brute force fix for the problem with one-to-many. I'll look on that soon.

Sergey Nebolsin - 13/Apr/07 03:48 PM
nullable:false constraint is now applied to all associations except Collections and Maps

And I think that the second part of this issue (about no errors on wrong associations) is related to another issue - cascading validation.

So this issue can be closed.