This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
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.
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.