Hi

I wish to use inheritance in EJB3.0

I use WebSphere Application Server 6.1.0.17 and IBM DB2 9.1




Parent entity:

@Entity
@Inheritance(strategy=InheritanceType.JOINED)
public class Mnvag implements Serializable
{
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
private long Id;
......
}




Child entity:

@Entity
@Inheritance(strategy=InheritanceType.JOINED)
public class Poezd extends Mnvag implements Serializable
{
private String stf;
private String stn;
private String pns;
......
}




persistence.xml:

?xml version= "1.0" encoding= "UTF-8"
persistence xmlns= "http://java.sun.com/xml/ns/persistence" xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance" version= "1.0" xsi:schemaLocation= "http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persisten...tence_1_0.xsd"
persistence-unit name= "ksarmDB"
jdbc/ds_non_jta
jdbc/ds_jta
com.cit.ksarm.om.Mnvag
com.cit.ksarm.om.Poezd






DB:

CREATE TABLE SA.MNVAG
(
ID BIGINT NOT NULL
);
 
ALTER TABLE SA.MNVAG ADD CONSTRAINT "CC1215423601125" PRIMARY KEY (ID);
 
CREATE TABLE SA.POEZD
(
ID BIGINT NOT NULL ,
STF CHAR(4) NOT NULL ,
PNS CHAR(3) NOT NULL ,
STN CHAR(4) NOT NULL
);




Stateless:

@Stateless
public class PoezdTaskImpl implements PoezdTask
{
@PersistenceContext(name= "ksarmDB" )
EntityManager em;

public void createPoezd() throws KsarmException
{
try
{
Poezd poe= new Poezd();
poe.setPns( "111" );
poe.setStf( "2222" );
poe.setStn( "3333" );

em.persist(poe);
}
catch (PersistenceException ex)
{
throw new KsarmException( "Ошибка персистенса: " +ex.getMessage());
}
catch (Exception ex)
{
throw new KsarmException( "Невозможно создать поезд: " +ex.getMessage());
}
}
}



It seems, that all is made correctly, but on em.persist(poe), Exception:



DB2 SQL error: SQLCODE: -530, SQLSTATE: 23503, SQLERRMC: SA.POEZD.CC1215423625953 {prepstmnt 1420711086 INSERT INTO Poezd (Id, pns, stf, stn) VALUES (?, ?, ?, ?) params=(long) 0, (String) 111, (String) 2222, (String) 3333 } code=-530, state=23503



What do I do not so?