• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Hibernate: adding underscore to attibute names

 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We're using annotations to map a class to a table in another schema, but the column names used in the queries generated by Hibernate are wrong, even when the column name is specified.


The hibernate query tries to load 'user_id', similarly the firstName, middleName and lastName are referred to as 'first_name', 'middle_name' and 'last_name' respectively.
The table already exists and is not created by Hibernate (it is SELECT only) and is running in MySQL 5.1 with Hibernate 3 and Spring.
I go around it by pointing it to a view in the remote schema instead, but I'd prefer it to work correctly.
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's a strange one. Are you sure the annotations are being picked up by Hibernate? Any hibernate boot logs?
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Note that this is also related to my other thread, while I believe it is related to the tmp user only having SELECT access on the User_ table so that Hibernate cannot use the DB Metadata to query the table. BUT I'm still confused as to why the annotations are not honoured.
 
Jaikiran Pai
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Going by those logs, it seems to be picking up *.hbm.xml file(s) from some place. Do you see any of those around in your application?
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I double checked, but no.
 
reply
    Bookmark Topic Watch Topic
  • New Topic