Hi all,
I generated entity classes from my database PostgreSQL and then I generated JpaController for all entity classes, but I have problem with edit and create item of one entity (IpSietKarta). I test it and I detect that only with set of one column is problem (column - fak_id). When I set this column, JpaController throws exception:
Error while commiting the transaction (java.sql.BatchUpdateException).
When I set entity without this column ALWAYS IS OK and update pass corectly.
There are my classes:
public class IpSietKarta implements Serializable {Code:
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator="sequence")
@SequenceGenerator(name="sequence", sequenceName="karta_id_seq", allocationSize=1)
@Basic(optional = false)
@Column(name = "karta_id", nullable = false)
private Integer kartaId;
@Column(name = "poc_id")
private Integer pocId;
@OneToOne(cascade = {CascadeType.ALL})
@JoinColumn(name = "poc_id", referencedColumnName="poc_id", insertable=false, updatable=false)
private IpPocitac ipPocitac;
@Column(name = "karta_adr")
private String kartaAdr;
@Column(name = "karta_typ")
private String kartaTyp;
@Column(name = "karta_irq")
private String kartaIrq;
@Column(name = "karta_io_adr")
private String kartaIoAdr;
@Column(name = "karta_mem")
private String kartaMem;
@Column(name = "dns_meno")
private String dnsMeno;
@Column(name = "fak_id")
private Integer fakId;
@OneToOne
//@JoinColumn(name = "fak_id", referencedColumnName = "fak_id")
@JoinColumn(name = "fak_id", referencedColumnName="fak_id", insertable=false, updatable=false)
private Fakulta fakulta;
@Column(name = "typ_zataze")
private String typZataze;
@Lob
@Column(name = "karta_ip_adr")
private String kartaIpAdr;
public class Fakulta implements Serializable {Code:
private static final long serialVersionUID = 1L;
@Id
@Basic(optional = false)
@Column(name = "fak_id", nullable = false)
private Integer fakId;
@Column(name = "fak_skratka")
private String fakSkratka;
@Column(name = "fak_popis")
private String fakPopis;
I think that problem is with Join entities, I try other alternative of declaration, but always was something wrong :(
When I try JoinColumn without insertable and updatable property, thows this exception:
org.hibernate.MappingException: Repeated column in mapping for entity: entity.IpSietKarta column: fak_id (should be mapped with insert="false" update="false")Where is problem? Thanks for any help with this... When you need more info for resolved this, I post it then...