camelCase to snake_case

16 views
Skip to first unread message

aw

unread,
Nov 1, 2009, 1:55:20 PM11/1/09
to Lift
I am using Lift-Mapper with Oracle. Oracle is a case-insensitive
database. For Hibernate projects, I have used the Enhanced Naming
Convention to translate Java camelCase to a more Oracle friendly
snake_case. I am interested in doing the same thing with Lift Mapper/
Record.

In the mean time, I need to override dbTableName and dbColumnName, but
I'd like to avoid that and just agree on the convention.

I could imagine that the Database Provider would maintain a flag to
say whether the database is case sensitive or not, and then based on
that flag, would pass either the camelCase directly (for case
sensitive), or snake_case(camelCase) (for case insensitive).

(Or, does this functionality already exist and I just haven't
configured it properly?)

Naftoli Gugenheim

unread,
Nov 1, 2009, 1:59:09 PM11/1/09
to lif...@googlegroups.com
Probably not too hard to do on your own via a trait: the trait should extend MappedField, override dbColumnName, and calculate it based on getClass.

-------------------------------------

David Pollak

unread,
Nov 1, 2009, 2:57:18 PM11/1/09
to lif...@googlegroups.com
It's not currently a feature, but please open a ticket http://github.com/dpp/liftweb/issues .  We'll get it into M8
--
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Surf the harmonics

Jeppe Nejsum Madsen

unread,
Nov 1, 2009, 4:04:49 PM11/1/09
to lif...@googlegroups.com
Naftoli Gugenheim <nafto...@gmail.com> writes:

> Probably not too hard to do on your own via a trait: the trait should extend MappedField, override dbColumnName, and calculate it based on getClass.

While this works, I think it is too tedious to do on all classes and
fields. I think a better approach would be to make the Connection
naming aware and just "do the right thing" (tm) based an the specified
naming convention

/Jepppe

David Pollak

unread,
Nov 1, 2009, 4:55:06 PM11/1/09
to lif...@googlegroups.com

Acually, I'm going to do it based on a single function in MapperRules.
 

/Jepppe


aw

unread,
Nov 1, 2009, 5:40:14 PM11/1/09
to Lift
Thank you. I will open an Issue for this. I was reluctant to do it
thinking that it was a user issue. ;-)

On Nov 1, 11:57 am, David Pollak <feeder.of.the.be...@gmail.com>
wrote:
> It's not currently a feature, but please open a tickethttp://github.com/dpp/liftweb/issues.  We'll get it into M8
Reply all
Reply to author
Forward
0 new messages