From: <leg...@at...> - 2003-06-16 10:01:01
|
The following comment has been added to this issue: Author: Chris Webb Created: Mon, 16 Jun 2003 5:00 AM Body: I've only tested it with MySQL but I'm sort of hoping that the alias concept is acceptable to other dialects. I am unable to test this fix on any other platform unfortunately. I'm farely confident that it will work with Oracle but I can't speak for any other dialects. To be honest I don't know for sure exactly what sort of SQL can be used to retrieve the identifier and therefore reliably know whether adding an alias is going to cause a problem. I think conceptually this fix is the right approach. My implementation might be a little unsophisticated though. What would help is a mechanism that could either reliably add a column alias to any arbitary SQL select statement, or retrieve the column alias already associated with the select statement. This would probably require some extra meta data or more sophisticated string parsing. --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/secure/ViewIssue.jspa?key=HB-92 Here is an overview of the issue: --------------------------------------------------------------------- Key: HB-92 Summary: Retrieving native generated identifiers does not support generic Hibernate types Type: Patch Status: Assigned Priority: Major Project: Hibernate2 Components: core Versions: 2.0 final Assignee: Gavin King Reporter: Chris Webb Created: Wed, 21 May 2003 5:00 AM Updated: Wed, 11 Jun 2003 8:01 AM Description: At present Hibernate does not support identifier types other than Short, Integer or Long for native generated identifiers. This presents a problem when a user defined type is used to encapsulate an identifier that can support natively generated identifiers. An example is where a identifier type is defined that stores the natively generated value internally as a long, thus is similiar to a Long type but not actually a Long type. The solution is to use the actual identifier type to extract the identifer value from the appropriate retrieve identifier SQL result set rather than the method IdentifierGeneratorFactory.get(ResultSet, Class) which in fact has been flagged as inappropriate in the source code documentation. A patch has been supplied that does the following: 1. Removes the method get(ResultSet, Class) from IdentifierGeneratorFactory. 2. Changes SequenceGenerator and AbstractEntityPersister to add an 'id' column alias to the SQL used for retrieving the natively generated identifier. 3 Changes SequenceGenerator, EntityPersister and NormalizedEntityPersister to retrieve the identifier value from the SQL result set using the identifer type via the method nullSafeGet(ResultSet rs, String colName, SessionImplementor session, Object owner). --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |