facebook

hibernate generated classes don’t keep upper case letters

  1. MyEclipse Archived
  2.  > 
  3. Bugs
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #213756 Reply

    slepit
    Member

    Hi,

    I am using the DB explorer to generate my hibernate classes, but it does not keep all the uppercase letters of the table and of the columns.

    For instance for table MyTable and columns MyColumn1, MyColumn2,
    it generates a class Mytable.java with attributes Mycolumn1, Mycolumn2 and getters getMycolumn1(), getMycolumn2().
    I would have expected it to generate MyTable.java with attributes MyColumn1, MyColumn2 and getters getMyColumn1(), getMyColumn2().

    sandy

    #213776 Reply

    snpe
    Member

    I don’t sure for your database, but differnet databases save object name in different way
    for instance – oracle save object name in all upper case, postgresl in lower case (You can cretae table with “MyTable”, but it is hard support in this databases)
    There is many method in DatabaseMetadata for check this behavior

    Tools can do the best for different databases – I think that ME have to have possiblity that use choose class name

    regards

    #213868 Reply

    support-jeff
    Member

    Plans are in the works for just such support. Right now, the only pattern that the Hibernate Tool knows is underscores, e.g. My_Table would become MyTable, but MyTable becomes Mytable (everything gets lowercased and then Java canonicalized)

    #213871 Reply

    snpe
    Member

    it is bad design for table name like Mytable (mix upper and lower case ), special if You want cross databases – for class it is fine

    Jeff, I think that is better if You make choice for class name for us

    regards

    #213885 Reply

    support-jeff
    Member

    You are being facetious of course, correct? 😉

    #213905 Reply

    snpe
    Member

    for what – assertion one or two ?

    one) you don’t know if you choose another database, tomorrow , correct ?

    If You choose postgresql or oracle then it is problem mix upper and lower case
    This query don’t work
    select * from MyTable

    postgres thin that is ‘mytable’, oracle ‘MYTABLE’
    You have to write select * from “MyTable” – it is same for any object

    two) what is a problem if we have choice for name of persistent class
    my favorite hibernate tools currently (middlegen) have this features

    regards

    #213907 Reply

    support-jeff
    Member

    #1 I completely agree. Use of underscores to separate “words” is an unwritten SQL standard (read this as common practice)

    #2 No problem at all, you just don’t get that feature with 3.8 GA. You will have to wait for the next iteration of feature development. Hopefully, if I get my way, your wait will be well worth it.

Viewing 7 posts - 1 through 7 (of 7 total)
Reply To: hibernate generated classes don’t keep upper case letters

You must be logged in to post in the forum log in