[code]@Entity
@SequenceGenerator(name = “SEQ_RPS_PRESTADOR”, sequenceName = “SEQ_RPS_PRESTADOR”, allocationSize = 1)
@Inheritance(strategy = InheritanceType.JOINED)
@Table(name = “RPS_PRESTADOR”)
public class Prestador extends UnimedEntity {
@Id
@NotNull
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = “SEQ_RPS_PRESTADOR”)
@Column(name = “ID_PRESTADOR”, nullable = false)
private Long id;
@OneToOne(fetch = FetchType.LAZY, mappedBy = "prestador", cascade = CascadeType.ALL)
@JoinColumn(name="ID_PRESTADOR", insertable=false, updatable=false)
private Vinculacao vinculacao;
}
[/code]
[code]@Entity
@SequenceGenerator(name = “SEQ_RPS_VINCULACAO”, sequenceName = “SEQ_RPS_VINCULACAO”, allocationSize = 1)
@Inheritance(strategy = InheritanceType.JOINED)
@Table(name = “RPS_VINCULACAO”)
public class Vinculacao {
@Id
@NotNull
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = “SEQ_RPS_VINCULACAO”)
@Column(name = “ID_VINCULACAO”, nullable = false)
private Long id;
@NotNull
@OneToOne(cascade=CascadeType.ALL, orphanRemoval=true)
@JoinColumn(name = "ID_PRESTADOR", insertable=false, updatable=false)
private Prestador prestador;
}[/code]
ERRO:
[quote]
Caused by: java.sql.BatchUpdateException: ORA-01400: não é possível inserir NULL em (“RPS_VINCULACAO”.“ID_PRESTADOR”)
at oracle.jdbc.driver.DatabaseError.throwBatchUpdateException(DatabaseError.java:343)
at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:10720)
at org.apache.commons.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:297)
at org.apache.commons.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:297)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:70)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:268)
... 98 more[/quote]