jaideep ganguli wrote:
[snip]
I' working on extending the Loader class to use stored procedures instead of the dynamically gerenarted sql statements.
I 've writtem a stored procedure that returns a result set, in which the column names are the same as the database table columns specified in the mapping xml. But, the loaders 'hydrate' method fails because it looks for columns with aliased names which are sometimes different from the database columns names.
Why does hibernate have to use aliases?
Is there a way to make it not use the aliases, but just the database column names?
thanks
Jaideep
I also have written one of these, although (see below) it's not as advanced as yours by far as yet, and given you are working on one I'm not sure I should bother to continue :)
I've got round the column aliasing (for now) by slapping anyone who uses a long column name, thus making the aliases == the column names. This will break for inheritance I believe but our model doesn't call for it.
I've handled insert/update/delete/load-by-id.
Wrt to handling more advanced queries I have the option of requiring the user to call stored procedures which return the set of matching IDs and load the persistent objects via load() individually (which isn't too bad as we are code-generating all of this type of this atm anyway) or to enhance the Persister. [ Is there anything, other than a performance hit, that I should be aware of when doing this? ]
At this time I've no idea how to tie into the Session.find/iterate methods - that's a job for tomorrow. How have you done it?
Are you able to make your Persister & related classes available or is it under some license / IP which restricts that?
Offtopic: to answer the "why use stored procedures" question from other threads - because the security nazi's are not granting direct SQL access.