Andreas,
No you don't have to map the discriminator column explicitly. The
model looks to be defined correctly, so its very odd that it would be null.
What does your execution code look like? I'm not well
versed in Scala but perhaps the
discriminator value
is being 'lost'
somewhere along the way?
Cheers,
Guy
On 19/08/2013 11:19 AM, Andreas Joseph
Krogh wrote:
I have a model which uses inheritance-type=SINGLE_TABLE:
@Entity
@Table(name = "origo_email_part")
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name = "part_type", discriminatorType = DiscriminatorType.STRING)
@SequenceGenerator(name = "EmailPartSEQ_STORE", sequenceName = "origo_email_part_entity_id_seq", allocationSize = 1)
@Cacheable
abstract class EmailPart
@Entity
@DiscriminatorValue("singlepart")
class EmailSinglePart (_uid: String, _charSet: Option[String], _stringContent: Option[String],
_mimeType: Option[String], _data: Blob, _fileName: Option[String])
extends EmailPart
And persisting it results in:
LOG: execute 0000000000000053: INSERT INTO
origo_email_part (entity_id, part_index, uid, VERSION,
message_id, parent_id, part_type) VALUES
($1, $2, $3, $4, $5, $6, $7)
DETAIL: parameters: $1 = '286417', $2 = '1', $3 =
'6a753912-f3cf-4daa-ba7a-3cac62526448', $4 = '1', $5 =
'402439', $6 = NULL, $7 = NULL
ERROR: null value in column "part_type" violates not-null
constraint
Doesn't EL persist the value of the discriminator-column?
Do I have to map it as a explicit column-value?
Thanks.
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
--

Guy Pelletier
ORACLE Canada,
45 O'Connor Street
Suite 400
Ottawa, Ontario
Canada K1P 1A4
Oracle is committed to developing practices
and products that help protect the environment
|