Search code examples
mysqlgrailsgrails-orm

Saved GORM domain object not showing up in mysql


I have a Message object that has log entries that are added as the message is processed.

Domain class Message has:

SortedSet messageLogEntries
static hasMany = [messageLogEntries: MessageLogEntry]

void addLogEntry(String entry) {
    def mle = new MessageLogEntry(logEntry: entry)
    this.addToMessageLogEntries(mle)
    this.save(failOnError: true, flush: true)
    log.debug(entry)
}

I can step through the code the entry is created and saved and allocated an id but when I query the database in MySql the entry is not there.

This was working but is not since I converted from mysql 5.5 to 5.6.10

Please help.


Solution

  • If this code is being executed inside a Hibernate transaction, you will not see it in the DB until the transaction is committed. Are you running this code inside an integration test or from a transactional execution stream (e.g. a service)?