endっていうプロパティ名はあんまし良くないらしい
grailsで作ったドメインクラスにendっていうプロパティ名をつけたら、save()時にorg.springframework.dao.InvalidDataAccessResourceUsageExceptionが発生した。
どうやらendがSQLで予約語の為に起きている事象?
例)
class Dog { Date start Date end }
実行結果)
groovy:000> d = new Dog(); ===> Dog : null groovy:000> d.start = new Date(); ===> Fri Oct 10 19:58:25 JST 2008 groovy:000> d.end = new Date(); ===> Fri Oct 10 19:58:30 JST 2008 groovy:000> d.save(); ERROR org.springframework.dao.InvalidDataAccessResourceUsageException: could not insert: [Dog]; nested exception is org. hibernate.exception.SQLGrammarException: could not insert: [Dog] at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException (SessionFactoryUtils.java:613) at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException (HibernateAccessor.java:412) at org.springframework.orm.hibernate3.HibernateTemplate.execute (HibernateTemplate.java:378) at org.springframework.orm.hibernate3.HibernateTemplate.execute (HibernateTemplate.java:338) at groovysh_evaluate.run (groovysh_evaluate:2)