|
In my sample plugin, I registered few Hibernate listeners, the listeners just prints message to console. def doWithSpring = { sanitizeHtmlListner(SanitizeHtmlListner) hibernateEventListeners(HibernateEventListeners) { listenerMap = ['save':sanitizeHtmlListner, 'update':sanitizeHtmlListner, 'pre-update':sanitizeHtmlListner, 'create':sanitizeHtmlListner, 'save-update':sanitizeHtmlListner] } } Both, SanitizeHtmlListner and HibernateEventListeners classes are imported. In integration
test Book b = new Book() b.name = "Sample book" b.save() println "Book ID :" + b.id b.name = "Name changed" b.save() I just created this test, so that i can debug into the listeners, but none of the listener method is being called. What am I doing wrong ? |
|
Don't know what happened, but now when i try to run the tests, it throws the exception (Somehow, initially it was not throwing exception, just won't invoke the listener)
This is related to the Hibernate listener, Here's the related stuff http://pastebin.com/5Epxbb8Z This looks related https://forum.hibernate.org/viewtopic.php?p=2404093 From: Sudhir N <[hidden email]> To: Grails-user <[hidden email]> Sent: Tuesday, 24 May 2011 1:22 PM Subject: [grails-user] Hibernate listeners are not called for integration tests ! In my sample plugin, I registered few Hibernate listeners, the listeners just prints message to console. def doWithSpring = {
sanitizeHtmlListner(SanitizeHtmlListner) hibernateEventListeners(HibernateEventListeners) { listenerMap = ['save':sanitizeHtmlListner, 'update':sanitizeHtmlListner, 'pre-update':sanitizeHtmlListner,
'create':sanitizeHtmlListner, 'save-update':sanitizeHtmlListner] } } Both, SanitizeHtmlListner and HibernateEventListeners classes are imported. In integration
test Book b = new Book() b.name = "Sample book" b.save() println "Book ID :" + b.id b.name = "Name changed" b.save() I just created this test, so that i can debug into the listeners, but none of the listener method is being called. What am I doing wrong ? |
|
Just figured out that this is a bug : Registering an event listener for "save, update etc" (SaveOrUpdateEventListener) Will cause ArrayStoreException at runtime . I just tried with "pre-insert" and it works without any issues. I don't know what all other event listeners will cause this issue. Will report a bug in Jira Thanks pledbrook, for help over IRC and getting the response from Graeme. It can be reproduced easily using the code http://pastebin.com/Nf4rxy9U Thanks From: Sudhir N <[hidden email]> To: "[hidden email]" <[hidden email]> Sent: Tuesday, 24 May 2011 3:15 PM Subject: Re: [grails-user] Hibernate listeners are not called for integration tests ! Don't know what happened, but now when i try to run the tests, it throws the exception (Somehow, initially it was not throwing exception, just won't invoke the listener)
This is related to the Hibernate listener, Here's the related stuff http://pastebin.com/5Epxbb8Z This looks related https://forum.hibernate.org/viewtopic.php?p=2404093 From: Sudhir N <[hidden email]> To: Grails-user <[hidden email]> Sent: Tuesday, 24 May 2011 1:22 PM Subject: [grails-user] Hibernate listeners are not called for integration tests ! In my sample plugin, I registered few Hibernate listeners, the listeners just prints message to console. def doWithSpring = {
sanitizeHtmlListner(SanitizeHtmlListner) hibernateEventListeners(HibernateEventListeners) { listenerMap = ['save':sanitizeHtmlListner, 'update':sanitizeHtmlListner, 'pre-update':sanitizeHtmlListner,
'create':sanitizeHtmlListner, 'save-update':sanitizeHtmlListner] } } Both, SanitizeHtmlListner and HibernateEventListeners classes are imported. In integration
test Book b = new Book() b.name = "Sample book" b.save() println "Book ID :" + b.id b.name = "Name changed" b.save() I just created this test, so that i can debug into the listeners, but none of the listener method is being called. What am I doing wrong ? |
| Powered by Nabble | See how NAML generates this page |
