Discriminating on a value in a joined table
-------------------------------------------
Key: HHH-5157
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-5157
Project: Hibernate Core
Issue Type: Bug
Affects Versions: 3.5.1
Reporter: Nicholas White
I'm re-opening
http://opensource.atlassian.com/projects/hibernate/browse/HHH-506 as
the following case doesn't work, and HHH-506 doesn't provide a solution in enough
detail:
Tables (for an Oracle database):
create table values (object integer, paramname varchar2(100), stringvalue varchar2(100),
numbervalue integer);
create table types (paramname varchar2(100), isstring char(1));
create table objects (id integer);
Classes (missing getters and setters for readability reasons):
class Object { private Integer id; private Set<Value> parameters;}
abstract class Value {private String paramname;}
class StringValue extends Value { private String value;}
class IntegerValue extends Value { private Integer value;}
I'd like to use the isstring column in the types table as a discriminator - if it is
'Y' then the StringValue subclass should be generated with a value field populated
from the stringvalue column of the values table. If it is 'N' then I'd like an
IntegerValue subclass to be created with its value field populated from the numbervalue
column of the values table.
Please don't reject this without providing an hbm.xml mappings file that maps this
structure (and that works with an Oracle database).
Thanks,
Nick
--
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....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira