From: Martin S. (JIRA) <no...@at...> - 2006-05-26 03:42:18
|
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1621?page=all ] Martin Schulz updated HHH-1621: ------------------------------- Attachment: HHH-1621 Patch > 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 |