Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Value of DiscriminatorValue not persisted

På mandag 19. august 2013 kl. 21:55:29, skrev Andreas Joseph Krogh <andreak@xxxxxxxxxxxx>:
På mandag 19. august 2013 kl. 17:51:32, skrev Guy Pelletier <guy.pelletier@xxxxxxxxxx>:
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?
 
Hm, strange, persisting the same type other places works. Do you have any pointers to where the value is retreived from when generating the INSERT-query so I can debug and step thru it to se what's going on?
 
Thanks.
 
I've tried to map the column explicitly in the super-class:
 
@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
//...
//...
@Column(name = "part_type")
var emailPartType: String = null
 
without luck, it still generates the INSERT with NULL:
 
LOG:  execute 00000000000000B0: INSERT INTO origo_email_part (entity_id, part_type, part_index, uid, VERSION, message_id, parent_id) VALUES ($1, $2, $3, $4, $5, $6, $7)
DETAIL:  parameters: $1 = '286520', $2 = NULL, $3 = '1', $4 = '50304a0d-17bc-46f3-a32c-f082b88d2e4c', $5 = '1', $6 = '402597', $7 = NULL
 
I hate to be a squeaky-wheel here, and realize people on this list don't get payed for helping out, but I'm sooo close to having ported our app from Hibernate to EL:-)
 
Any pointers to where I can start debugging why the NULL-value is there is grately appreciated, where in the code EL inserts the value of the @DiscriminatorValue-annotation in the parameter-list to the SQL generated etc.
 
Also; I'd rather not map the "part_type"-column explicitly if it can be avoided.
 
Thanks.
 
--
Andreas Joseph Krogh <andreak@xxxxxxxxxxxx>      mob: +47 909 56 963
Senior Software Developer / CTO - OfficeNet AS - http://www.officenet.no
Public key: http://home.officenet.no/~andreak/public_key.asc
 

Back to the top