From: Andreas S. (JIRA) <no...@at...> - 2006-06-08 01:49:20
|
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1621?page=comments#action_23296 ] Andreas Schaefer commented on HHH-1621: --------------------------------------- I ran into the same issue and could it pin down to the fact that when this conditions: - Discriminiator Column is not specified as a column (I guess that is unmapped) - There is a Column with the same prefix - The maximum length for an alias for the DB in question is short enough that the prefix of the discriminator column and the other column are equal when cut off then I get a select statement with the same alias for the discriminator column and the other column and so you see the other's column value in the parentesis '(Discriminator: D)'. This is caused by the fact that the unique id for a column used to generate the alias is not only set when the column is added through the table but that is not the case when the discriminator column is not mapped. I hacked that by just added a special character when the alias is created for the discrimantor column. -Andy > subclass mapping by discriminator - should instantiate parent for unmapped discriminator values > ----------------------------------------------------------------------------------------------- > > Key: HHH-1621 > URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1621 > Project: Hibernate3 > Type: Improvement > Components: core > Environment: 3.1.2 > Sybase ASE 12.5.3 > Reporter: Martin Schulz > Attachments: HHH-1621 > > > Scenario: The parent class A has a discriminator field and some but all possible scriminator values are mapped to subclasses. > Current behavior: > 1) Default: > The following exception is thrown > org.hibernate.WrongClassException: Object with id: 10000 was not of the specified subclass: A (Discriminator: D) > at org.hibernate.loader.Loader.getInstanceClass(Loader.java:1445) > [ the error itself is also quite misleading, as the row is exactly of / for the specified class A. But there simply was no > subclass found ]. > 2) discriminator with force="true" > The parent class is never instantiated, only the mapped subclasses are instantiated. > Proposed behavior: > The parent class should be instantiated for those rows with unmapped discriminator values. > Characteristics of proposed behavior: > - all rows in resultset would lead to instantiated class in the inheritence tree, > - the behavior would be in line with how joined-subclass behaves > - no caveat documentation required > Implementation: > (Easy) > in Loader.java, lines 1443ff, do not throw WrongClassException, but instead > return persister.getEntityName(); > (Alternate) > change persister.getSubclassForDiscriminatorValue() implementations correspondingly. > Thx for your consideration / vote. -- 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/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |