Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: 1.1
-
Fix Version/s: 1.2-M1
-
Component/s: Persistence
-
Labels:None
-
Testcase included:yes
Description
When a domain class has a field mapped by a UserType GrailsDomainClassProperty.isAssociation() and isOneToOne() both return true. This is a problem with, for example, any class using joda-time properties, e.g.
class Person {
org.joda.time.LocalDate birthday
static mapping = {
birthday type: org.joda.time.contrib.hibernate.PersistentLocalDate
}
}
def app = org.codehaus.groovy.grails.commons.ApplicationHolder.application
def dc = app.getArtefact("Domain", "Person")
def prop = dc.getPropertyByName("birthday")
assert prop.type == org.joda.time.LocalDate
assert !prop.association // FAILS
assert !prop.oneToOne // FAILS
The main difficulty I've found that this causes is that list.gsp and show.gsp scaffolding templates have to be customised to handle these types otherwise Grails will try to render them as association properties and the scaffolding will crash.
In 1.1.1 this is causing an additional problem when using a org.joda.time.DateTime field for dateCreated and/or lastUpdated. See http://www.nabble.com/Problem-with-Joda-plugin-and-autotimestamping-tp24068191p24068191.html and http://adhockery.blogspot.com/2009/06/joda-time-auto-timestamping-issue-on.html