-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: problem with edit and create
PostPosted: Tue Mar 29, 2011 3:43 pm 
Newbie

Joined: Tue Mar 29, 2011 3:21 pm
Posts: 1
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...


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.