Hi,
I have two classes, AA which inherits from A. I use two tables and a
discriminator. The discriminator is null in the table when the class is
persisted. Here is my code deployed on AS 4.0.4CR2
***********
Class A
***********
@Entity
| @Table(name = "A")
| @Inheritance(strategy = InheritanceType.JOINED)
| @DiscriminatorColumn(name = "DISCRIMINATOR", discriminatorType =
DiscriminatorType.STRING, length = 5)
| @DiscriminatorValue("A")
| public class A implements Serializable {
|
| private short ida;
|
| public A() {
| }
|
| public A(short ida) {
| this.ida = ida;
| }
|
| @SequenceGenerator(name = "gen_a", sequenceName = "seq_a_id",
allocationSize=1)
| @Id
| @GeneratedValue(strategy = SEQUENCE, generator = "gen_a")
| @Column(name="IDA")
| public short getIda() {
| return ida;
| }
| public void setIda(short ida) {
| this.ida = ida;
| }
| }
***********
Class AA
***********
@Entity
| @Table(name = "AA")
| @PrimaryKeyJoinColumn(name = "IDAA")
| @DiscriminatorValue("AA")
| public class AA extends A {
|
| }
***********
TABLES
***********
CREATE TABLE A (
| idA number(2) constraint a_pk primary key,
| discriminator varchar2(5) constraint a_c_discriminator check
(discriminator in ('A','AA'))
| );
|
| create table AA(
| idAA number(2) constraint aa_pk primary key constraint aa_ref_a
references a
| );
***********
CLIENT
***********
public void test(){
| ...
|
| AA a = new AA();
| adao.persist(a);
|
| ...
| }
**********
Thanks for your help
Nicolas Roux
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3937437#3937437
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3937437
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user