Railo, ORM and MySQL 5.5.x gotcha

On February 1, 2012, in ColdFusion, Railo, by Anuj Gakhar

I was testing the ORM stuff in the latest version of Railo (3.3.1.000 final) and after setting up the ORM settings in Application.cfc, when I tried to run the code, I could not get Railo to create the database tables, even with dbcreate=”dropcreate”. Here is my code, that was not working :-

[cf]
this.ormsettings = {
cfclocation = ‘model’,
dialect = "MySQLwithInnoDB",
dbcreate = "dropcreate",
eventHandling = true,
logSQl = true,
autoManageSession = false,
flushAtRequestEnd = true,
eventHandler = "model.ORMEventHandler"
};[/cf]

The above code would not create the database tables even with ORMReload() or ORMFlush(). Then I came across this Railo Issue which clarifies what the issue is. Looks like with MySQL 5.5.x, the dialect needs to be MySQL5. Here is the correct code that works :-
[cf highlight=”3″]
this.ormsettings = {
cfclocation = ‘model’,
dialect = "MySQL5",
dbcreate = "dropcreate",
eventHandling = true,
logSQl = true,
autoManageSession = false,
flushAtRequestEnd = true,
eventHandler = "model.ORMEventHandler"
};
[/cf]

Not sure why MySQL5 needs a separate dialect – maybe someone can shed some more light on this?

Tagged with:  

3 Responses to Railo, ORM and MySQL 5.5.x gotcha

  1. Seth says:

    This was immensely helpful to me. Thanks for taking the time to share it with the world. I spent all night trying to get the dbcreate setting to have an effect and with your post I’ve gotten it working.

  2. Kevin says:

    I can’t believe it took so long to find this… Thanks!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

© 2011 Anuj Gakhar
%d bloggers like this: