Oracle Naming Strategy for Hibernate Released as a proper Open Source Project
I am a big fan of creating at least the basic structure of your database from the domain model using hibernate. But if you work with Oracle you know on problem with this approach: the length of names is seriously limited for tables and columns. So if you have a inner class with embeddables you pretty soon bump against that limit of 30 characters.
I published before an OracleNamingStrategy that fixes this problem by creating abbreviations on this blog. But writing a new blog entry with all the code every time I find a little glitch in the code felt just wrong. So I published it as an official Open Source Project over at google code: The Hibernate Naming Strategy for Oracle! And I just released the first version. and since it is so extremely simple, it isn’t even a jar but a single java file.
I’d be glad if this is of some use for other developers. If you like it, drop me a line in the comments. If you find a bug or have an idea for improvement use the issue tracker.
Could you post a few examples of how it changes the names when it is run through this class?
Thanks,
Sarel
One example would be the name
SomeLongNamedEntityForDemonstrationPurposes
becomes
some_long_nam_ent_for_dem_purp
It also supports embeddables, so you can have multiple embeddables attributes of the same type in one class without a problem
Great work!
This is exactly what I was looking for when I typed “namingstrategy oracle” into google.
It seems to work well so far – I’ll be more than happy to report any suggestions or bugs as I continue to use it.
Hi Daniel,
thanks for the nice comment, I am looking forward to the bug reports and suggestions