Polymorphic Query on named field using @Inheritance(strategy=InheritanceType.JOINED)

Description

Using a Joined table strategy and annotation definitions, Hibernate does not respect the name parameter from a column annotation, as in @Column(name = "ES_CELL_LINE"), in the generation of a polymorphic query on the parent type.

@Entity
@Table(name = "GENOTYPE")
@Inheritance(strategy=InheritanceType.JOINED)
public class Genotype implements java.io.Serializable {
private int genotypeKey;
...
}

@Entity
@Table(name = "GENOTYPE_TARGETED")
public class GenotypeTargeted extends Genotype {

private String ESCellLine;

@Column(name = "ES_CELL_LINE", length = 32)
@Length(max = 32)
public void setESCellLine(String eSCellLine) {
ESCellLine = eSCellLine;
}
public String getESCellLine() {
return ESCellLine;
}
}

Using the query "select distinct g from Genotype g" produces a query containing "genotype4_1_.ESCellLine as ESCellLine69_3_," rather than "genotype4_1_.ES_CELL_LINE as ESCellLine69_3_," as would be expected. All named fields from the parent class are correct, while all named fields from the subclasses use the field name rather than the value of the name parameter.

Environment

None

Activity

Show:

July 15, 2010 at 5:22 PM

Mark this as invalid, please. Eclipse generated getters and setters in the reverse of the order I expected, so my annotations were incorrectly on the setters. Just user error.

Rejected

Details

Assignee

Reporter

Bug Testcase Reminder (view)

Bug reports should generally be accompanied by a test case!

Bug Testcase Reminder (edit)

Bug reports should generally be accompanied by a test case!

Participants

S

Affects versions

Priority

Created July 15, 2010 at 4:58 PM
Updated July 15, 2010 at 6:59 PM
Resolved July 15, 2010 at 6:59 PM